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

[Perf] Avoid allocations in the Sanitizer #6

Open
wants to merge 1 commit into
base: mainnet-staging
Choose a base branch
from

Conversation

ljedrz
Copy link
Collaborator

@ljedrz ljedrz commented Jun 3, 2024

The Sanitizer is used very prominently in our parsing functions, and it is also a source of many allocations, most of which are temporary. Similarly to #5, it is possible to avoid using some of the expensive parsing functions, though in this case we need to apply some heuristics.

The perf improvements are quite large, and I've measured them both with a 15-minute run of a --dev node and using hyperfine on a small binary that parsed all the valid .aleo programs currently present in the snarkVM codebase.

dev node:

  • all allocs are down ~15%, of which almost all are temporary
  • in Program::from_str specifically, allocs are reduced by ~64%, of which temp allocs ~88%

parsing all .aleo programs using Program::from_str:

  • allocs are reduced by ~41%
  • growth reallocs are down ~70%
  • runtime is reduced by ~31%

Update: I crunched the parsing figures again using Program::from_str (as opposed to just Sanitizer::parse), which provides a better bigger picture.

@vicsn
Copy link
Collaborator

vicsn commented Jun 3, 2024

@d0cd

@vicsn vicsn force-pushed the mainnet-staging branch from 74a4378 to d48f6fb Compare June 5, 2024 12:33
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