-
Notifications
You must be signed in to change notification settings - Fork 219
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
Thousands of hard-coded constants slows down execution time by 7x. #6457
Comments
I'm guessing this is due to having many copies of |
While makearray could help since it'd deduplicate constants per function, I think what would be the most effective solution to this is introducing globals in SSA, so this constant would appear exactly once in the program |
This pulls across noir-lang/noir#6558 from the main noir repo which addresses the issue with compiling bloblib noir-lang/noir#6457. cc @MirandaWood @iAmMichaelConnor
2 potential bugs here.
Checkout this branch: iAmMichaelConnor/blob-lib#5
Update the Nargo.toml to point to v0.4.0 (or later... I was testing it against
main
, locally).Turn your attention to the
config.nr
andnegative_roots.nr
files. You'll see thousands of hard-coded constants.Now observe:
Run
nargo execute
onmain.nr
. This took 28 minutes on my old 2019 MacBook Pro i9.Now comment-out all those constants and uncomment the "array of zeros" version. Do it in both
config.nr
andnegative_roots.nr
.E.g. see this pic for what to uncomment:
Again, run
nargo execute
onmain.nr
. It'll break with some kind of "stack too deep" error. Very strange.Now delete those thousands of lines of commented-out hard-coded constants.
Again, run
nargo execute
onmain.nr
. The "stack too deep" error will disappear. This took 3 mins 50 seconds.Observations:
Thanks to @MirandaWood for first spotting this!
The text was updated successfully, but these errors were encountered: