moved boxes and nullables to arena#1593
Conversation
Benchmarking resultsBenchmark for program
|
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
11.191 ± 0.091 | 11.109 | 11.423 | 5.75 ± 0.06 |
cairo-native (embedded AOT) |
1.945 ± 0.011 | 1.925 | 1.961 | 1.00 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
2.031 ± 0.017 | 2.001 | 2.057 | 1.04 ± 0.01 |
Benchmark for program dict_snapshot
Open benchmarks
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
530.8 ± 5.5 | 524.1 | 540.2 | 1.00 |
cairo-native (embedded AOT) |
1640.3 ± 12.5 | 1622.0 | 1662.2 | 3.09 ± 0.04 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
1756.6 ± 18.0 | 1727.8 | 1779.4 | 3.31 ± 0.05 |
Benchmark for program factorial_2M
Open benchmarks
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
4.951 ± 0.068 | 4.898 | 5.061 | 2.36 ± 0.04 |
cairo-native (embedded AOT) |
2.098 ± 0.012 | 2.079 | 2.120 | 1.00 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
2.145 ± 0.019 | 2.113 | 2.177 | 1.02 ± 0.01 |
Benchmark for program fib_2M
Open benchmarks
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
4.821 ± 0.045 | 4.797 | 4.949 | 2.97 ± 0.04 |
cairo-native (embedded AOT) |
1.625 ± 0.012 | 1.611 | 1.653 | 1.00 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
1.698 ± 0.017 | 1.673 | 1.727 | 1.04 ± 0.01 |
Benchmark for program linear_search
Open benchmarks
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
567.9 ± 2.1 | 565.0 | 571.3 | 1.00 |
cairo-native (embedded AOT) |
1696.3 ± 18.0 | 1660.8 | 1720.7 | 2.99 ± 0.03 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
1823.0 ± 22.7 | 1784.6 | 1859.4 | 3.21 ± 0.04 |
Benchmark for program logistic_map
Open benchmarks
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
483.4 ± 6.6 | 477.8 | 496.0 | 1.00 |
cairo-native (embedded AOT) |
1800.3 ± 15.3 | 1780.9 | 1831.3 | 3.72 ± 0.06 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
1987.8 ± 18.8 | 1961.1 | 2016.5 | 4.11 ± 0.07 |
Benchmark results Main vs HEAD.Base
Head
Base
Head
Base
Head
Base
Head
Base
Head
Base
Head
|
orizi
left a comment
There was a problem hiding this comment.
@orizi reviewed 1 file and all commit messages, and made 1 comment.
Reviewable status: 1 of 11 files reviewed, 1 unresolved discussion (waiting on TomerStarkware).
src/executor.rs line 355 at r1 (raw file):
builtin_stats.blake = BLAKE_CALL_COUNT.with(|c| c.replace(0)) as usize; // Reset the box arena to free all allocated memory.
maybe this entire bump object be just stored in metadata or something of that sort?
6d23fc6 to
cad7b7f
Compare
orizi
left a comment
There was a problem hiding this comment.
@orizi reviewed 17 files and all commit messages, made 1 comment, and resolved 1 discussion.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on TomerStarkware).
src/libfuncs/array.rs line 206 at r3 (raw file):
)?)?; // Move the data into the array and free the original tuple. Since the tuple and the array are
fix doc.
make sure next PR removes almost all memcopies.
cad7b7f to
2e34eb4
Compare
TomerStarkware
left a comment
There was a problem hiding this comment.
@TomerStarkware made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on orizi).
src/libfuncs/array.rs line 206 at r3 (raw file):
Previously, orizi wrote…
fix doc.
make sure next PR removes almost all memcopies.
Done.
orizi
left a comment
There was a problem hiding this comment.
@orizi reviewed 1 file and all commit messages, made 1 comment, and resolved 1 discussion.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on TomerStarkware).
2e34eb4 to
c184d71
Compare
orizi
left a comment
There was a problem hiding this comment.
@orizi reviewed 3 files and all commit messages, and made 1 comment.
Reviewable status: 16 of 17 files reviewed, all discussions resolved (waiting on TomerStarkware).
orizi
left a comment
There was a problem hiding this comment.
@orizi reviewed 1 file.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on TomerStarkware).
#Move Box and Nullable allocations to a per-invocation arena
Replace individual
realloc/freecalls forBoxandNullableallocations with a thread-local bumpalo arena that is reset once per program invocation.cairo_native__box_alloc(size, align)allocates out of a thread-localBumparena, registered as theBoxAllocruntime binding (src/runtime.rs,src/metadata/runtime_bindings.rs).invoke_dynamiccallscairo_native__reset_box_arena()after the trampoline returns, freeing all box/nullable memory allocated during that invocation in one shot(
src/executor.rs).box,const,enum::boxed_match,struct::boxed_deconstruct) now route all box allocations throughinto_box→RuntimeBindingsMeta::box_alloc, and no longer emitfreeonunbox/boxed_match/span_from_tuple.types/box.rsandtypes/nullable.rs:reallocand is only registered when the inner type actually has a dup override (the pure-memcpy path is gone).freeis removed since arena memory is reclaimed at invocation end.Value::from_ptrno longerlibc_frees the inner pointer forBox/Nullablepayloads.Introduces Breaking Changes?
No
This change is