Page MenuHomeWildfire Games

Potential GUI speedup in Builder
Needs ReviewPublic

Authored by wraitii on May 30 2023, 6:21 PM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

Checking whether templates exist goes through the VFS, which is generally kinda slow (probably worse in dev builds). We should cache these. Note that we could reuse the loaded templates on the C++ side, but that actually won't cache bad-entities (such as Apadana for mace for example).
Storing it in the JS component like that seems neat, is performant, and resists nicely to hotloading and reloading games.

The MP safety assumes that the VFS doesn't change mid-game, but I think that's safe enough.

To profile this, you need to be in visual mode and select units that can build stuff. You also need to 'refresh' the selection, by e.g. having some selected units die.

Test Plan

Profile, agree.

Unit TestsFailed

TimeTest
0 msJenkins > TestComponentScripts::Debug: Test / test_scripts
Test failed: Stack trace: testEntitiesList@simulation/components/tests/test_Builder.js:65:25 @simulation/components/tests/test_Builder.js:104:1
0 msJenkins > TestComponentScripts::Release: Test / test_scripts
Test failed: Stack trace: testEntitiesList@simulation/components/tests/test_Builder.js:65:25 @simulation/components/tests/test_Builder.js:104:1
0 msJenkins > TestComponentScripts::test_scripts
Test failed: Stack trace: testEntitiesList@simulation/components/tests/test_Builder.js:65:25 @simulation/components/tests/test_Builder.js:104:1
0 msJenkins > TestAllocators::Debug: Test / test_da
0 msJenkins > TestAllocators::Release: Test / test_da
View Full Test Results (3 Failed · 2,387 Passed)

Event Timeline

wraitii created this revision.May 30 2023, 6:21 PM

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/8104/display/redirect

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/7013/display/redirect

wraitii published this revision for review.May 30 2023, 7:29 PM

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/8687/display/redirect

Freagarach added inline comments.
binaries/data/mods/public/simulation/components/Builder.js
53

Is this the best datatype?

55

Sounds like a helper more components could benefit from?