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

Cache VariableExpressions on load. #14524

Merged
merged 1 commit into from Dec 17, 2017

Conversation

RoosterDragon
Copy link
Member

Compiling these expressions is sadly expensive, and we needed new ones for every trait on every actor each time one was generated. The expressions thankfully can be shared as they are pure functions, which removes this overhead.

Saves 15% of CPU during initial game load (caused by loading actors for the RA shellmap). This would also save a bit of CPU when creating new actors during regular games too.

@pchote
Copy link
Member

pchote commented Dec 16, 2017

Confirmed that this provides a 10-15% improvement in RA startup time on macOS/mono 5.4.1.7.
The speedup on Linux is potentially much larger because of #13526.

pchote
pchote previously approved these changes Dec 16, 2017
@pchote pchote modified the milestones: Next + 1, Next release Dec 16, 2017
Compiling these expressions is sadly expensive, and we needed new ones for every trait on every actor each time one was generated. The expressions thankfully can be shared as they are pure functions, which removes this overhead.
@RoosterDragon
Copy link
Member Author

(fixed naming to appease StyleCop)

@reaperrr
Copy link
Contributor

Reproduceably improves RA startup time by 20% (~2400ms vs. ~3000ms on bleed) on my system (Win10x64, msbuild-compiled debug build).

@reaperrr reaperrr merged commit de38313 into OpenRA:bleed Dec 17, 2017
@RoosterDragon RoosterDragon deleted the cache-expressions branch December 18, 2017 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants