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

chore: benchmark sha256 number of instructions executed in AVM #11253

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dbanks12
Copy link
Collaborator

@dbanks12 dbanks12 commented Jan 15, 2025

Also move hash stuff into another AVM test contract.

This lets us get stats like below, although note that this isn't directly an output from the yarn tests:

For a sha256 of N bytes, how many AVM/Brillig instructions are executed and how much gas does it consume?

N=  20 bytes:   4513 instructions,   77778 L2 Gas
N=  30 bytes:   5328 instructions,   91326 L2 Gas
N=  40 bytes:   5843 instructions,  100098 L2 Gas
N=  50 bytes:   6672 instructions,  113877 L2 Gas
N=  60 bytes:   7490 instructions,  127626 L2 Gas
N=  70 bytes:   8662 instructions,  147936 L2 Gas
N=  80 bytes:   9207 instructions,  157368 L2 Gas
N=  90 bytes:  10052 instructions,  171576 L2 Gas
N= 100 bytes:  10597 instructions,  181008 L2 Gas
N= 255 bytes:  23046 instructions,  392055 L2 Gas
N= 256 bytes:  23022 instructions,  392121 L2 Gas
N= 511 bytes:  43107 instructions,  732336 L2 Gas
N= 512 bytes:  42978 instructions,  731004 L2 Gas
N=2048 bytes: 162801 instructions, 2765820 L2 Gas```

@dbanks12 dbanks12 requested a review from fcarreiro as a code owner January 15, 2025 20:41
Copy link
Contributor

Changes to public function bytecode sizes

Generated at commit: 99f763c92dfeb0f9abd1e4652fe280930ae5acab, compared to commit: 946a418d138c1b2bee3a5dc14096616a902cc0b7

🧾 Summary (100% most significant diffs)

Program Bytecode size in bytes (+/-) %
AvmTest::bulk_testing -2 ✅ -0.01%
AvmTest::public_dispatch -4,542 ✅ -7.26%

Full diff report 👇
Program Bytecode size in bytes (+/-) %
AvmTest::bulk_testing 23,094 (-2) -0.01%
AvmTest::public_dispatch 58,006 (-4,542) -7.26%

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