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

feat: Optimize bytecode size for pedersen hash #8910

Closed
wants to merge 4 commits into from

Conversation

sirasistant
Copy link
Collaborator

After #8798 we are using msm instead of a pedersen opcode. This PR should optimize a bit bytecode size for pedersen implemented in noir, by avoiding vecs and using generic arithmetic instead.

Copy link
Contributor

github-actions bot commented Oct 1, 2024

Changes to public function bytecode sizes

Generated at commit: a39f9fe584d2644bb95f80f013cab8c5b2c22126, compared to commit: fd0e9455ac667366f060a3b9d955b075adb8c5da

🧾 Summary (100% most significant diffs)

Program Bytecode size in bytes (+/-) %
Auth::public_dispatch +509 ❌ +1.57%
TokenBlacklist::public_dispatch +893 ❌ +0.67%
TokenBlacklist::update_roles +66 ❌ +0.41%
AvmTest::public_dispatch +28 ❌ +0.03%
TokenBlacklist::constructor -3 ✅ -0.02%
Auth::set_authorized -3 ✅ -0.03%
Auth::set_authorized_delay -3 ✅ -0.03%
AvmTest::bulk_testing -90 ✅ -0.29%
NFT::public_dispatch -214 ✅ -0.55%
CardGame::public_dispatch -169 ✅ -0.60%
Test::public_dispatch -229 ✅ -0.70%
TokenBlacklist::transfer_public -190 ✅ -1.19%
TokenBlacklist::mint_public -190 ✅ -1.80%
TokenBlacklist::shield -254 ✅ -2.09%
CardGame::on_cards_claimed -169 ✅ -2.26%
TokenBlacklist::burn_public -254 ✅ -2.39%
NFT::finalize_transfer_to_private -209 ✅ -3.74%
TokenBlacklist::mint_private -254 ✅ -3.83%
Test::create_l2_to_l1_message_public -115 ✅ -4.94%
TokenBlacklist::get_roles -254 ✅ -6.09%
AvmTest::pedersen_hash_with_index -285 ✅ -8.38%
AvmTest::pedersen_hash -285 ✅ -8.38%
Auth::get_authorized_delay -254 ✅ -8.51%
Auth::get_authorized -249 ✅ -9.15%
Auth::get_scheduled_authorized -249 ✅ -9.49%

Full diff report 👇
Program Bytecode size in bytes (+/-) %
Auth::public_dispatch 32,986 (+509) +1.57%
TokenBlacklist::public_dispatch 134,022 (+893) +0.67%
TokenBlacklist::update_roles 16,350 (+66) +0.41%
AvmTest::public_dispatch 89,690 (+28) +0.03%
TokenBlacklist::constructor 16,303 (-3) -0.02%
Auth::set_authorized 11,615 (-3) -0.03%
Auth::set_authorized_delay 11,419 (-3) -0.03%
AvmTest::bulk_testing 31,368 (-90) -0.29%
NFT::public_dispatch 38,997 (-214) -0.55%
CardGame::public_dispatch 27,987 (-169) -0.60%
Test::public_dispatch 32,621 (-229) -0.70%
TokenBlacklist::transfer_public 15,823 (-190) -1.19%
TokenBlacklist::mint_public 10,339 (-190) -1.80%
TokenBlacklist::shield 11,878 (-254) -2.09%
CardGame::on_cards_claimed 7,306 (-169) -2.26%
TokenBlacklist::burn_public 10,370 (-254) -2.39%
NFT::finalize_transfer_to_private 5,376 (-209) -3.74%
TokenBlacklist::mint_private 6,377 (-254) -3.83%
Test::create_l2_to_l1_message_public 2,215 (-115) -4.94%
TokenBlacklist::get_roles 3,920 (-254) -6.09%
AvmTest::pedersen_hash_with_index 3,116 (-285) -8.38%
AvmTest::pedersen_hash 3,116 (-285) -8.38%
Auth::get_authorized_delay 2,731 (-254) -8.51%
Auth::get_authorized 2,471 (-249) -9.15%
Auth::get_scheduled_authorized 2,375 (-249) -9.49%

@sirasistant
Copy link
Collaborator Author

Hmmm that's weird

@sirasistant
Copy link
Collaborator Author

It's indeed bigger in some of them, but no idea why

@sirasistant sirasistant closed this Oct 1, 2024
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.

1 participant