refactor(ec): store EcState in projective coordinates - #1654
Open
TomerStarkware wants to merge 1 commit into
Open
refactor(ec): store EcState in projective coordinates#1654TomerStarkware wants to merge 1 commit into
TomerStarkware wants to merge 1 commit into
Conversation
Benchmarking resultsBenchmark for program
|
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
10.586 ± 0.050 | 10.513 | 10.685 | 5.89 ± 0.05 |
cairo-native (embedded AOT) |
1.798 ± 0.014 | 1.776 | 1.816 | 1.00 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
1.813 ± 0.022 | 1.791 | 1.856 | 1.01 ± 0.01 |
Benchmark for program dict_snapshot
Open benchmarks
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
523.9 ± 3.4 | 519.0 | 529.6 | 1.00 |
cairo-native (embedded AOT) |
1650.3 ± 6.9 | 1641.8 | 1657.6 | 3.15 ± 0.02 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
1660.6 ± 12.0 | 1643.0 | 1677.3 | 3.17 ± 0.03 |
Benchmark for program factorial_2M
Open benchmarks
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
4.668 ± 0.040 | 4.630 | 4.737 | 2.72 ± 0.03 |
cairo-native (embedded AOT) |
1.715 ± 0.016 | 1.697 | 1.748 | 1.00 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
1.738 ± 0.023 | 1.707 | 1.780 | 1.01 ± 0.02 |
Benchmark for program fib_2M
Open benchmarks
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
4.677 ± 0.046 | 4.621 | 4.778 | 2.77 ± 0.05 |
cairo-native (embedded AOT) |
1.691 ± 0.026 | 1.652 | 1.737 | 1.00 ± 0.02 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
1.686 ± 0.025 | 1.643 | 1.719 | 1.00 |
Benchmark for program linear_search
Open benchmarks
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
573.3 ± 7.0 | 563.7 | 589.4 | 1.00 |
cairo-native (embedded AOT) |
1688.4 ± 24.0 | 1651.3 | 1731.2 | 2.95 ± 0.06 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
1739.0 ± 15.9 | 1718.7 | 1760.0 | 3.03 ± 0.05 |
Benchmark for program logistic_map
Open benchmarks
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
491.1 ± 6.4 | 478.7 | 497.6 | 1.00 |
cairo-native (embedded AOT) |
1667.0 ± 19.4 | 1640.0 | 1708.3 | 3.39 ± 0.06 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
1677.5 ± 15.2 | 1657.9 | 1698.6 | 3.42 ± 0.05 |
Benchmark results Main vs HEAD.Base
Head
Base
Head
Base
Head
Base
Head
Base
Head
Base
Head
|
TomerStarkware
force-pushed
the
tomer/use_projective_ec_points
branch
from
August 16, 2026 12:48
bcb9830 to
d42c68b
Compare
`EcState` was stored as an affine pair, so every `ec_state_add` ended in `to_affine()` — a modular inversion — only for the next add to undo it. Storing the accumulator projectively defers that to a single inversion in `ec_state_try_finalize_nz`, so the cost of a chain of adds no longer grows with its length.
TomerStarkware
force-pushed
the
tomer/use_projective_ec_points
branch
from
August 16, 2026 13:02
d42c68b to
474cceb
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
EcStatewas stored as an affine pair, so everyec_state_addended into_affine()— a modular inversion — only for the next add to undo it. Storing the accumulator projectively defers that to a single inversion inec_state_try_finalize_nz, so the cost of a chain of adds no longer grows with its length.