Skip to content

Conversation

@DiegoCivi
Copy link
Contributor

@DiegoCivi DiegoCivi commented Dec 8, 2025

Implement StructBoxedDeconstruct libfunc

Implements the new Struct libfunc:

  • StructConcreteLibfunc::BoxedDeconstruct

Closes #1475

Introduces Breaking Changes?

No.

Checklist

  • Linked to Github Issue.
  • Unit tests added.
  • Integration tests added.
  • This change requires new documentation.
    • Documentation has been added/updated.

@codecov-commenter
Copy link

codecov-commenter commented Dec 8, 2025

Codecov Report

❌ Patch coverage is 96.80851% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.58%. Comparing base (5df2d2c) to head (d879c89).

Files with missing lines Patch % Lines
src/libfuncs/struct.rs 96.77% 2 Missing ⚠️
src/libfuncs/box.rs 96.87% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1491      +/-   ##
==========================================
+ Coverage   79.52%   79.58%   +0.05%     
==========================================
  Files         108      108              
  Lines       26667    26739      +72     
==========================================
+ Hits        21208    21280      +72     
  Misses       5459     5459              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link

github-actions bot commented Dec 8, 2025

Benchmark results Main vs HEAD.

Base

Command Mean [s] Min [s] Max [s] Relative
base dict_insert.cairo (JIT) 2.042 ± 0.037 1.968 2.102 1.04 ± 0.03
base dict_insert.cairo (AOT) 1.969 ± 0.037 1.932 2.044 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head dict_insert.cairo (JIT) 1.947 ± 0.013 1.927 1.970 1.03 ± 0.01
head dict_insert.cairo (AOT) 1.892 ± 0.022 1.856 1.923 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base dict_snapshot.cairo (JIT) 1.787 ± 0.034 1.744 1.836 1.07 ± 0.03
base dict_snapshot.cairo (AOT) 1.663 ± 0.027 1.623 1.705 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head dict_snapshot.cairo (JIT) 1.733 ± 0.019 1.700 1.761 1.05 ± 0.02
head dict_snapshot.cairo (AOT) 1.650 ± 0.029 1.618 1.714 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base factorial_2M.cairo (JIT) 2.168 ± 0.021 2.117 2.189 1.03 ± 0.01
base factorial_2M.cairo (AOT) 2.098 ± 0.014 2.075 2.116 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head factorial_2M.cairo (JIT) 2.146 ± 0.025 2.103 2.179 1.02 ± 0.02
head factorial_2M.cairo (AOT) 2.110 ± 0.022 2.079 2.154 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base fib_2M.cairo (JIT) 1.692 ± 0.016 1.668 1.721 1.03 ± 0.02
base fib_2M.cairo (AOT) 1.637 ± 0.020 1.595 1.664 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head fib_2M.cairo (JIT) 1.704 ± 0.027 1.675 1.749 1.05 ± 0.02
head fib_2M.cairo (AOT) 1.620 ± 0.021 1.595 1.652 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base linear_search.cairo (JIT) 1.822 ± 0.018 1.794 1.845 1.09 ± 0.02
base linear_search.cairo (AOT) 1.676 ± 0.024 1.645 1.718 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head linear_search.cairo (JIT) 1.856 ± 0.026 1.824 1.893 1.07 ± 0.03
head linear_search.cairo (AOT) 1.734 ± 0.048 1.666 1.794 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base logistic_map.cairo (JIT) 1.969 ± 0.018 1.942 2.002 1.09 ± 0.02
base logistic_map.cairo (AOT) 1.807 ± 0.030 1.769 1.868 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head logistic_map.cairo (JIT) 2.016 ± 0.027 1.980 2.056 1.10 ± 0.02
head logistic_map.cairo (AOT) 1.836 ± 0.027 1.784 1.877 1.00

@github-actions
Copy link

github-actions bot commented Dec 8, 2025

Benchmarking results

Benchmark for program dict_insert

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 10.746 ± 0.110 10.615 10.917 5.53 ± 0.13
cairo-native (embedded AOT) 1.942 ± 0.041 1.874 1.982 1.00
cairo-native (embedded JIT using LLVM's ORC Engine) 2.058 ± 0.045 2.002 2.137 1.06 ± 0.03

Benchmark for program dict_snapshot

Open benchmarks
Command Mean [ms] Min [ms] Max [ms] Relative
Cairo-vm (Rust, Cairo 1) 556.4 ± 6.4 547.9 565.2 1.00
cairo-native (embedded AOT) 1649.6 ± 32.1 1604.2 1712.9 2.97 ± 0.07
cairo-native (embedded JIT using LLVM's ORC Engine) 1792.5 ± 25.7 1755.8 1834.6 3.22 ± 0.06

Benchmark for program factorial_2M

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 4.852 ± 0.034 4.817 4.940 2.31 ± 0.03
cairo-native (embedded AOT) 2.103 ± 0.021 2.073 2.134 1.00
cairo-native (embedded JIT using LLVM's ORC Engine) 2.149 ± 0.029 2.114 2.215 1.02 ± 0.02

Benchmark for program fib_2M

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 4.738 ± 0.016 4.711 4.759 2.87 ± 0.04
cairo-native (embedded AOT) 1.650 ± 0.021 1.624 1.676 1.00
cairo-native (embedded JIT using LLVM's ORC Engine) 1.714 ± 0.036 1.680 1.792 1.04 ± 0.03

Benchmark for program linear_search

Open benchmarks
Command Mean [ms] Min [ms] Max [ms] Relative
Cairo-vm (Rust, Cairo 1) 606.4 ± 7.1 597.3 616.9 1.00
cairo-native (embedded AOT) 1681.2 ± 13.0 1661.3 1698.3 2.77 ± 0.04
cairo-native (embedded JIT using LLVM's ORC Engine) 1816.1 ± 21.5 1790.1 1863.3 2.99 ± 0.05

Benchmark for program logistic_map

Open benchmarks
Command Mean [ms] Min [ms] Max [ms] Relative
Cairo-vm (Rust, Cairo 1) 503.8 ± 13.3 494.8 538.8 1.00
cairo-native (embedded AOT) 1803.4 ± 17.1 1774.4 1834.2 3.58 ± 0.10
cairo-native (embedded JIT using LLVM's ORC Engine) 1980.6 ± 19.5 1943.4 2003.5 3.93 ± 0.11

Copy link
Contributor

@FrancoGiachetta FrancoGiachetta left a comment

Choose a reason for hiding this comment

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

We should check if the patch affects corelib's tests related to this libfunc. If so, we should change the patch.

Copy link
Contributor

@JulianGCalderon JulianGCalderon left a comment

Choose a reason for hiding this comment

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

This libfunc unboxes the input, and the deconstructs it. Is it possible to reuse the logic from build_deconstruct?

@JulianGCalderon
Copy link
Contributor

This libfunc unboxes the input, and the deconstructs it. Is it possible to reuse the logic from build_deconstruct?

Now that I think of it, build_deconstruct is really small and its a bit different, so its okay as it is.

@gabrielbosio
Copy link
Collaborator

We should check if the patch affects corelib's tests related to this libfunc. If so, we should change the patch.

@DiegoCivi does this change affect corelib tests?

@DiegoCivi
Copy link
Contributor Author

DiegoCivi commented Dec 19, 2025

There are no mentions of this libfunc on our patch. The corelib does not mention the libfunc since its 'extern'.
cc @gabrielbosio @FrancoGiachetta

Copy link
Contributor

@JulianGCalderon JulianGCalderon left a comment

Choose a reason for hiding this comment

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

Looks good!

@gabrielbosio gabrielbosio added the libfuncs Library Function implementations label Dec 23, 2025
@gabrielbosio gabrielbosio added this pull request to the merge queue Dec 23, 2025
Merged via the queue into main with commit f0a4fdb Dec 23, 2025
39 of 43 checks passed
@gabrielbosio gabrielbosio deleted the struct_boxed_decons-libfunc branch December 23, 2025 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

libfuncs Library Function implementations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[2.14.0] Implement StructBoxedDeconstruct

6 participants