Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed property results in convResearch #3798

Merged
merged 3 commits into from May 13, 2024
Merged

Conversation

1269339743
Copy link
Contributor

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

@past-due past-due added this to the 4.5.0-beta1 milestone May 9, 2024
@past-due past-due merged commit bdf4a4c into Warzone2100:master May 13, 2024
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants