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

Save contract execution time #102

Merged
merged 27 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
d9b40f2
Add proof of concept
JulianGCalderon Dec 4, 2024
b5ede27
Add same proof of concept to BenchTx
JulianGCalderon Dec 4, 2024
d12ed7b
Implement save_executions in benchmark feature
JulianGCalderon Dec 4, 2024
d987807
Rename method
JulianGCalderon Dec 4, 2024
959e86c
Document unwrap
JulianGCalderon Dec 4, 2024
06d82da
Add argument for output path
JulianGCalderon Dec 4, 2024
41d9c50
Disable charge fee
JulianGCalderon Dec 4, 2024
0eafe1d
Ignore pyc
JulianGCalderon Dec 5, 2024
6ebdfb2
Add utils
JulianGCalderon Dec 5, 2024
1f94c1c
Save benchmark data output
JulianGCalderon Dec 5, 2024
74b46ed
Adapt plotter
JulianGCalderon Dec 5, 2024
6925fef
Concat dataframes at the start
JulianGCalderon Dec 5, 2024
068aca7
Only save selector
JulianGCalderon Dec 5, 2024
c46382d
Point to sequencer
JulianGCalderon Dec 5, 2024
e484f45
Update benchmark block
JulianGCalderon Dec 5, 2024
9aba898
Use .json instead of .jsonl
JulianGCalderon Dec 5, 2024
a300476
Fail if missmatch between native and vm
JulianGCalderon Dec 5, 2024
8eb51e9
Fix clippy
JulianGCalderon Dec 5, 2024
1ac30fc
Fix clippy
JulianGCalderon Dec 5, 2024
a2db2c4
Update sequencer rev
JulianGCalderon Dec 6, 2024
74ee2ab
Handle time zero bug
JulianGCalderon Dec 6, 2024
91f22c0
Print csv
JulianGCalderon Dec 9, 2024
870c2da
Group by selector also
JulianGCalderon Dec 9, 2024
d3f1901
Update README
JulianGCalderon Dec 9, 2024
8411157
Merge branch 'main' into bench-by-call
JulianGCalderon Dec 9, 2024
29d8cfb
Add profiling feature
JulianGCalderon Dec 11, 2024
ab4d981
Fix clippy
JulianGCalderon Dec 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
debug/
target/
**.pyc

.env
.envrc
Expand Down
52 changes: 26 additions & 26 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ serde_with = "3.11.0"
serde = "1.0.197"
cairo-native = "0.2.4"
# Sequencer Dependencies
starknet_api = { git = "https://github.com/lambdaclass/sequencer.git", rev = "bfc5b6b5475d359b8fc910516e026d972be5d02f" } # replay
blockifier = { git = "https://github.com/lambdaclass/sequencer.git", rev = "bfc5b6b5475d359b8fc910516e026d972be5d02f", features = ["cairo_native"] } # replay
starknet_gateway = { git = "https://github.com/lambdaclass/sequencer.git", rev = "bfc5b6b5475d359b8fc910516e026d972be5d02f" } # replay
blockifier_reexecution = { git = "https://github.com/lambdaclass/sequencer.git", rev = "bfc5b6b5475d359b8fc910516e026d972be5d02f" } # replay
starknet_api = { git = "https://github.com/lambdaclass/sequencer.git", rev = "2ad9ecad71bd71304b80c36992f41568c82313ad" } # replay
blockifier = { git = "https://github.com/lambdaclass/sequencer.git", rev = "2ad9ecad71bd71304b80c36992f41568c82313ad", features = ["cairo_native"] } # replay
starknet_gateway = { git = "https://github.com/lambdaclass/sequencer.git", rev = "2ad9ecad71bd71304b80c36992f41568c82313ad" } # replay
blockifier_reexecution = { git = "https://github.com/lambdaclass/sequencer.git", rev = "2ad9ecad71bd71304b80c36992f41568c82313ad" } # replay
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,17 +126,25 @@ In the `plotting` directory, you can find python scripts to plot relevant inform
Make sure to erase the `compiled_programs` directory, then run:

```bash
cargo run --features benchmark,structured_logging bench-block-range 724000 724000 mainnet 1 | tee native-logs
cargo run --features benchmark,structured_logging,only_cairo_vm bench-block-range 724000 724000 mainnet 1 | tee vm-logs
./scripts/benchmark_tx.sh <tx> <net> <block> <laps>
```

This generates four files:
- `{native,vm}-data-$tx-$net.json`: Contains the execution time of each contract call
- `{native,vm}-logs-$tx-$net.json`: Contains the output of running the benchmark

If you want to benchmark a full block, you could run:
```bash
./scripts/benchmark_block.sh <block-start> <block-end> <net> <laps>
```

Once you have done this, you can use the plotting scripts:

- `python ./plotting/plot_execution_time.py native-data vm-data`: Plots the execution time of Native vs VM, by contract class.
- `python ./plotting/plot_compilation_memory.py native-logs`: Size of the compiled native libraries, by contract class.
- `python ./plotting/plot_compilation_memory_corr.py native-logs vm-logs`: Size of the compiled native libraries, by the associated Casm contract size.
- `python ./plotting/plot_compilation_memory_trend.py native-logs vm-logs`: Size of the compiled native and casm contracts, by the sierra contract size.
- `python ./plotting/plot_compilation_time.py native-logs`: Native compilation time, by contract class
- `python ./plotting/plot_compilation_time_trend.py native-logs vm-logs`: Native and Casm compilation time, by the sierra contract size.
- `python ./plotting/plot_execution_time.py native-logs vm-logs`: Plots the execution time of Native vs VM, by contract class.
- `python ./plotting/plot_compilation_time_finer.py native-logs`: Native compilation time, with fine-grained stage separation, by contract class.

Loading
Loading