Skip to content

refactor(sqrt): Make sqrt libfuncs runtime-bindings based.#1644

Merged
orizi merged 1 commit into
mainfrom
orizi/06-13-refactor_sqrt_runtime_bindings
Jun 17, 2026
Merged

refactor(sqrt): Make sqrt libfuncs runtime-bindings based.#1644
orizi merged 1 commit into
mainfrom
orizi/06-13-refactor_sqrt_runtime_bindings

Conversation

@orizi

@orizi orizi commented Jun 14, 2026

Copy link
Copy Markdown
Collaborator

Refactor sqrt implementations to runtime.

Introduces Breaking Changes?

No.


This change is Reviewable

@orizi orizi requested a review from TomerStarkware June 14, 2026 11:47
@github-actions

github-actions Bot commented Jun 14, 2026

Copy link
Copy Markdown

Benchmarking results

Benchmark for program dict_insert

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 10.596 ± 0.085 10.521 10.788 5.95 ± 0.06
cairo-native (embedded AOT) 1.781 ± 0.009 1.766 1.795 1.00
cairo-native (embedded JIT using LLVM's ORC Engine) 1.791 ± 0.007 1.783 1.806 1.01 ± 0.01

Benchmark for program dict_snapshot

Open benchmarks
Command Mean [ms] Min [ms] Max [ms] Relative
Cairo-vm (Rust, Cairo 1) 531.2 ± 3.5 527.4 539.1 1.00
cairo-native (embedded AOT) 1600.5 ± 9.9 1590.3 1619.1 3.01 ± 0.03
cairo-native (embedded JIT using LLVM's ORC Engine) 1615.6 ± 5.4 1602.4 1621.7 3.04 ± 0.02

Benchmark for program factorial_2M

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 4.624 ± 0.074 4.573 4.829 2.21 ± 0.04
cairo-native (embedded AOT) 2.092 ± 0.012 2.079 2.119 1.00
cairo-native (embedded JIT using LLVM's ORC Engine) 2.110 ± 0.010 2.093 2.123 1.01 ± 0.01

Benchmark for program fib_2M

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 4.507 ± 0.048 4.471 4.633 2.82 ± 0.03
cairo-native (embedded AOT) 1.596 ± 0.005 1.587 1.602 1.00
cairo-native (embedded JIT using LLVM's ORC Engine) 1.633 ± 0.011 1.620 1.653 1.02 ± 0.01

Benchmark for program linear_search

Open benchmarks
Command Mean [ms] Min [ms] Max [ms] Relative
Cairo-vm (Rust, Cairo 1) 568.3 ± 5.3 562.3 575.9 1.00
cairo-native (embedded AOT) 1614.1 ± 7.6 1599.9 1621.6 2.84 ± 0.03
cairo-native (embedded JIT using LLVM's ORC Engine) 1649.0 ± 4.9 1640.1 1654.1 2.90 ± 0.03

Benchmark for program logistic_map

Open benchmarks
Command Mean [ms] Min [ms] Max [ms] Relative
Cairo-vm (Rust, Cairo 1) 488.0 ± 5.4 479.8 496.3 1.00
cairo-native (embedded AOT) 1786.6 ± 24.0 1761.0 1834.5 3.66 ± 0.06
cairo-native (embedded JIT using LLVM's ORC Engine) 1889.3 ± 6.7 1883.6 1903.5 3.87 ± 0.04

@github-actions

github-actions Bot commented Jun 14, 2026

Copy link
Copy Markdown

Benchmark results Main vs HEAD.

Base

Command Mean [s] Min [s] Max [s] Relative
base dict_insert.cairo (JIT) 1.955 ± 0.032 1.904 2.016 1.01 ± 0.02
base dict_insert.cairo (AOT) 1.928 ± 0.025 1.873 1.962 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head dict_insert.cairo (JIT) 2.049 ± 0.048 1.960 2.115 1.05 ± 0.03
head dict_insert.cairo (AOT) 1.943 ± 0.040 1.898 2.004 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base dict_snapshot.cairo (JIT) 1.743 ± 0.016 1.721 1.768 1.01 ± 0.01
base dict_snapshot.cairo (AOT) 1.723 ± 0.016 1.698 1.755 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head dict_snapshot.cairo (JIT) 1.717 ± 0.021 1.687 1.755 1.03 ± 0.01
head dict_snapshot.cairo (AOT) 1.660 ± 0.008 1.647 1.673 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base factorial_2M.cairo (JIT) 2.223 ± 0.020 2.196 2.254 1.01 ± 0.01
base factorial_2M.cairo (AOT) 2.199 ± 0.022 2.168 2.246 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head factorial_2M.cairo (JIT) 2.184 ± 0.021 2.160 2.229 1.02 ± 0.01
head factorial_2M.cairo (AOT) 2.150 ± 0.017 2.129 2.184 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base fib_2M.cairo (JIT) 1.741 ± 0.023 1.705 1.781 1.00
base fib_2M.cairo (AOT) 1.741 ± 0.039 1.694 1.824 1.00 ± 0.03

Head

Command Mean [s] Min [s] Max [s] Relative
head fib_2M.cairo (JIT) 1.685 ± 0.018 1.663 1.730 1.01 ± 0.01
head fib_2M.cairo (AOT) 1.674 ± 0.013 1.651 1.692 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base linear_search.cairo (JIT) 1.791 ± 0.020 1.757 1.829 1.04 ± 0.02
base linear_search.cairo (AOT) 1.728 ± 0.019 1.699 1.771 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head linear_search.cairo (JIT) 1.773 ± 0.025 1.737 1.814 1.03 ± 0.02
head linear_search.cairo (AOT) 1.720 ± 0.026 1.695 1.767 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base logistic_map.cairo (JIT) 2.015 ± 0.029 1.976 2.059 1.07 ± 0.02
base logistic_map.cairo (AOT) 1.878 ± 0.015 1.859 1.904 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head logistic_map.cairo (JIT) 2.002 ± 0.025 1.956 2.026 1.05 ± 0.02
head logistic_map.cairo (AOT) 1.914 ± 0.024 1.867 1.954 1.00

@TomerStarkware TomerStarkware left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

@TomerStarkware reviewed 4 files and all commit messages, and made 2 comments.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on orizi).


src/metadata/runtime_bindings.rs line 1233 at r1 (raw file):

    context: &'ctx Context,
    location: Location<'ctx>,
    func_symbol: &str,

func_symbol == sqrt_type.symbol()
can be removed from the parameters

@TomerStarkware TomerStarkware left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

@TomerStarkware made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on orizi).

@orizi orizi force-pushed the orizi/06-13-refactor_sqrt_runtime_bindings branch from 255c03a to 479a385 Compare June 17, 2026 12:37
@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown

✅ Code is now correctly formatted.

@orizi orizi left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@orizi made 1 comment.
Reviewable status: 1 of 5 files reviewed, 1 unresolved discussion (waiting on TomerStarkware).


src/metadata/runtime_bindings.rs line 1233 at r1 (raw file):

Previously, TomerStarkware wrote…

func_symbol == sqrt_type.symbol()
can be removed from the parameters

Done.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@orizi orizi force-pushed the orizi/06-13-refactor_sqrt_runtime_bindings branch from 479a385 to 1261db5 Compare June 17, 2026 12:55
@orizi orizi enabled auto-merge June 17, 2026 13:24

@TomerStarkware TomerStarkware left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

@TomerStarkware reviewed 4 files and all commit messages, and made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on orizi).

@orizi orizi added this pull request to the merge queue Jun 17, 2026
Merged via the queue into main with commit 795c240 Jun 17, 2026
15 checks passed
@orizi orizi deleted the orizi/06-13-refactor_sqrt_runtime_bindings branch June 17, 2026 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants