refactor(cast): merge upcast and downcast implementation of felt252 c… - #1652
Merged
TomerStarkware merged 1 commit intoAug 5, 2026
Merged
Conversation
|
✅ Code is now correctly formatted. |
Benchmarking resultsBenchmark for program
|
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
10.876 ± 0.042 | 10.783 | 10.957 | 5.65 ± 0.07 |
cairo-native (embedded AOT) |
1.928 ± 0.023 | 1.902 | 1.958 | 1.00 ± 0.02 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
1.925 ± 0.023 | 1.883 | 1.962 | 1.00 |
Benchmark for program dict_snapshot
Open benchmarks
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
561.3 ± 7.9 | 550.0 | 574.8 | 1.00 |
cairo-native (embedded AOT) |
1703.7 ± 37.4 | 1654.4 | 1763.7 | 3.04 ± 0.08 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
1700.9 ± 18.9 | 1671.6 | 1725.2 | 3.03 ± 0.05 |
Benchmark for program factorial_2M
Open benchmarks
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
4.654 ± 0.017 | 4.634 | 4.686 | 2.69 ± 0.02 |
cairo-native (embedded AOT) |
1.729 ± 0.021 | 1.703 | 1.767 | 1.00 ± 0.01 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
1.728 ± 0.011 | 1.714 | 1.745 | 1.00 |
Benchmark for program fib_2M
Open benchmarks
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
4.817 ± 0.029 | 4.794 | 4.894 | 2.76 ± 0.07 |
cairo-native (embedded AOT) |
1.745 ± 0.046 | 1.673 | 1.830 | 1.00 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
1.772 ± 0.021 | 1.734 | 1.799 | 1.02 ± 0.03 |
Benchmark for program linear_search
Open benchmarks
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
599.9 ± 5.0 | 591.3 | 606.4 | 1.00 |
cairo-native (embedded AOT) |
1756.4 ± 26.5 | 1711.6 | 1795.1 | 2.93 ± 0.05 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
1794.5 ± 31.5 | 1763.3 | 1876.2 | 2.99 ± 0.06 |
Benchmark for program logistic_map
Open benchmarks
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
509.6 ± 19.0 | 492.6 | 559.5 | 1.00 |
cairo-native (embedded AOT) |
1685.3 ± 39.4 | 1620.6 | 1732.5 | 3.31 ± 0.15 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
1716.2 ± 36.2 | 1679.0 | 1781.2 | 3.37 ± 0.14 |
Benchmark results Main vs HEAD.Base
Head
Base
Head
Base
Head
Base
Head
Base
Head
Base
Head
|
…anonicalization Check downcast bounds against info.to_range instead of the destination type's range, and convert signed two's complement values to the canonical felt representation (negative = P - absolute) when downcasting to felt252, via a signed_to_felt252_repr helper shared with build_upcast. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
TomerStarkware
force-pushed
the
tomer/merge-upcast-and-downcast-implementation
branch
from
August 5, 2026 08:22
a9f2e88 to
d796b82
Compare
orizi
approved these changes
Aug 5, 2026
orizi
left a comment
Collaborator
There was a problem hiding this comment.
@orizi reviewed 1 file and all commit messages, and made 1 comment.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on TomerStarkware).
TomerStarkware
deleted the
tomer/merge-upcast-and-downcast-implementation
branch
August 5, 2026 12:08
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.
…anonicalization
Check downcast bounds against info.to_range instead of the destination type's range, and convert signed two's complement values to the canonical felt representation (negative = P - absolute) when downcasting to felt252, via a signed_to_felt252_repr helper shared with build_upcast.
This change is