Created
February 1, 2024 22:24
-
-
Save charles-cooper/cfee0460891d3e0f1d3e433610773e53 to your computer and use it in GitHub Desktop.
generate benchmarks for transient storage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
with open("benchmark_control.easm", "w") as f: | |
print("PUSH1 251", file=f) | |
print("PUSH1 1", file=f) | |
for _ in range(10_000): # stay roughly within codesize limit, still large enough for benchmark | |
print("DUP2 MUL", file=f) | |
print("DUP1 DUP1 POP POP", file=f) | |
with open("benchmark_easy_mload.easm", "w") as f: | |
print("PUSH1 0", file=f) | |
for _ in range(10_000): # stay roughly within codesize limit, still large enough for benchmark | |
print("DUP1 MLOAD POP", file=f) | |
with open("benchmark_sha3.easm", "w") as f: | |
print("PUSH1 1", file=f) | |
print("PUSH1 0", file=f) | |
for _ in range(10_000): # stay roughly within codesize limit, still large enough for benchmark | |
print("DUP2 ADD", file=f) | |
print("DUP1 PUSH1 0 MSTORE PUSH1 32 PUSH1 0 SHA3 POP", file=f) | |
# 251 is the largest prime number <= 256 | |
with open("benchmark_tload_pure.easm", "w") as f: | |
print("PUSH1 251", file=f) | |
print("PUSH1 1", file=f) | |
for _ in range(10_000): # stay roughly within codesize limit, still large enough for benchmark | |
print("DUP2 MUL", file=f) | |
print("DUP1 TLOAD POP", file=f) | |
with open("benchmark_tstore.easm", "w") as f: | |
print("PUSH1 251", file=f) | |
print("PUSH1 1", file=f) | |
for _ in range(10_000): # stay roughly within codesize limit, still large enough for benchmark | |
print("DUP2 MUL", file=f) | |
print("DUP1 DUP1 TSTORE", file=f) | |
with open("benchmark_easy_tstore.easm", "w") as f: | |
print("PUSH1 251", file=f) | |
for _ in range(10_000): # stay roughly within codesize limit, still large enough for benchmark | |
print("DUP1 DUP1 TSTORE", file=f) | |
with open("benchmark_tstore_tload.easm", "w") as f: | |
print("PUSH1 251", file=f) | |
print("PUSH1 1", file=f) | |
for _ in range(10_000): # stay roughly within codesize limit, still large enough for benchmark | |
print("DUP2 MUL", file=f) | |
print("DUP1 DUP1 TSTORE DUP1 TLOAD POP", file=f) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment