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

Optimize release and benchmark builds #310

Merged
merged 1 commit into from
Dec 14, 2023

Conversation

Sharktheone
Copy link
Member

I've added some options in Cargo.toml to optimize the performance of release and benchmark builds.

  • lto or link time optimizations, allows optimizations across codegen units and even languages (for example when we are using v8). It also inlines most of the functions. See this and this
  • codegen-units Disallows the compiler to split code in multiple codegen-units, which results in a bit better performence.
  • opt-level Level at which the compiler optimizes things. (e.g unrolling loops, ...)

This of course causes the build to take much longer. From my measurements a full release build takes about 23.3s instead of 10.8s on my machine. A rebuild (with some dependencies already built) takes 17.3s instead of 2.8s.

Development builds are untouched, so they only take 6.2s with or without these options.

The benchmark results go up ~10-11%.

Benchmark results

TreeIterator - wikipedia

TreeIterator

TreeIterator - stackoverflow

TreeIterator

TreeConstructor

TreeConstructor

Tokenizer

Tokenizer

@jaytaph
Copy link
Member

jaytaph commented Dec 6, 2023

This sounds good. We dont need to worry much about prod builds, but its good to have it already

@jaytaph
Copy link
Member

jaytaph commented Dec 11, 2023

pr author check fail is fine. This probably needs finetuning or we might need to get rid of it if it doesn't work out well enough..

@jaytaph jaytaph merged commit 5762236 into gosub-io:main Dec 14, 2023
4 of 5 checks passed
@Sharktheone Sharktheone deleted the optimize-release branch December 14, 2023 08:42
@Sharktheone
Copy link
Member Author

pr author check fail is fine. This probably needs finetuning or we might need to get rid of it if it doesn't work out well enough..

Probably because I didn't add myself to the file.

@jaytaph
Copy link
Member

jaytaph commented Dec 14, 2023

maybe, but that check is still broken :-)

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.

2 participants