fixed property results in convResearch #3798
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
the convResearch have output property "results" undocumented, it is an array of empty objects,
QuickJS_DefinePropertyValue(ctx, value, "results", mapJsonToQuickJSValue(ctx, psResearch->results, 0), JS_PROP_ENUMERABLE);
JSON.stringify(getResearch("R-Wpn-Cannon-ROF06",me).results) -> [{},{}]
new Array(100000).fill(0).forEach(i=>getResearch("R-Wpn-Cannon-ROF06",me)) 2.2s E5-2683 v4 @ 1.20GHz
if add JS_PROP_ENUMERABLE, "results" will be array of normal objects
QuickJS_DefinePropertyValue(ctx, value, "results", mapJsonToQuickJSValue(ctx, psResearch->results, JS_PROP_ENUMERABLE), JS_PROP_ENUMERABLE);
JSON.stringify(getResearch("R-Wpn-Cannon-ROF06",me).results) -> [{"class":"Weapon","filterParameter":"ImpactClass","filterValue":"CANNON","parameter":"FirePause","value":-10},{"class":"Weapon","filterParameter":"ImpactClass","filterValue":"CANNON","parameter":"ReloadTime","value":-10}]
new Array(100000).fill(0).forEach(i=>getResearch("R-Wpn-Cannon-ROF06",me)) 2.3s E5-2683 v4 @ 1.20GHz
It not performance bottleneck, and it make AI that have adaptive research path possible