Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make dicts clone on write. #964

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open

Conversation

azteca1998
Copy link
Collaborator

@azteca1998 azteca1998 commented Dec 13, 2024

Depends on #963.

Checklist

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

Copy link

github-actions bot commented Dec 17, 2024

Benchmarking results

Benchmark for program factorial_2M

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 13.712 ± 0.079 13.597 13.845 10.16 ± 0.06
cairo-native (embedded AOT) 4.298 ± 0.016 4.273 4.320 3.18 ± 0.01
cairo-native (embedded JIT using LLVM's ORC Engine) 4.113 ± 0.026 4.079 4.159 3.05 ± 0.02
cairo-native (standalone AOT with -march=native) 1.350 ± 0.003 1.347 1.357 1.00

Benchmark for program fib_2M

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 14.090 ± 0.117 13.941 14.319 180.06 ± 2.31
cairo-native (embedded AOT) 3.850 ± 0.038 3.788 3.903 49.21 ± 0.69
cairo-native (embedded JIT using LLVM's ORC Engine) 3.643 ± 0.043 3.576 3.735 46.55 ± 0.72
cairo-native (standalone AOT with -march=native) 0.078 ± 0.001 0.078 0.082 1.00

Benchmark for program linear_search

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 5.855 ± 0.041 5.757 5.900 2943.51 ± 66.33
cairo-native (embedded AOT) 3.960 ± 0.046 3.923 4.065 1990.83 ± 48.42
cairo-native (embedded JIT using LLVM's ORC Engine) 3.863 ± 0.024 3.836 3.903 1942.00 ± 43.25
cairo-native (standalone AOT with -march=native) 0.002 ± 0.000 0.002 0.002 1.00

Benchmark for program logistic_map

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 5.737 ± 0.061 5.660 5.815 23.62 ± 0.26
cairo-native (embedded AOT) 4.104 ± 0.019 4.064 4.127 16.90 ± 0.09
cairo-native (embedded JIT using LLVM's ORC Engine) 3.927 ± 0.027 3.893 3.985 16.16 ± 0.12
cairo-native (standalone AOT with -march=native) 0.243 ± 0.001 0.242 0.244 1.00

Copy link

github-actions bot commented Dec 17, 2024

Benchmark results Main vs HEAD.

Command Mean [s] Min [s] Max [s] Relative
base factorial_2M.cairo (JIT) 4.001 ± 0.027 3.968 4.050 1.00
base factorial_2M.cairo (AOT) 4.180 ± 0.021 4.149 4.212 1.04 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
:--- ---: ---: ---: ---:
head factorial_2M.cairo (JIT) 4.062 ± 0.021 4.015 4.084 1.00
head factorial_2M.cairo (AOT) 4.276 ± 0.027 4.222 4.307 1.05 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base fib_2M.cairo (JIT) 3.535 ± 0.016 3.510 3.561 1.00
base fib_2M.cairo (AOT) 3.774 ± 0.065 3.694 3.871 1.07 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
:--- ---: ---: ---: ---:
head fib_2M.cairo (JIT) 3.595 ± 0.030 3.553 3.638 1.00
head fib_2M.cairo (AOT) 3.804 ± 0.046 3.736 3.890 1.06 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base linear_search.cairo (JIT) 3.783 ± 0.041 3.734 3.843 1.00
base linear_search.cairo (AOT) 3.845 ± 0.028 3.813 3.904 1.02 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
:--- ---: ---: ---: ---:
head linear_search.cairo (JIT) 3.788 ± 0.029 3.739 3.826 1.00
head linear_search.cairo (AOT) 3.914 ± 0.058 3.826 4.008 1.03 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base logistic_map.cairo (JIT) 3.830 ± 0.019 3.804 3.856 1.00
base logistic_map.cairo (AOT) 3.995 ± 0.048 3.928 4.058 1.04 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
:--- ---: ---: ---: ---:
head logistic_map.cairo (JIT) 3.933 ± 0.044 3.870 4.003 1.00
head logistic_map.cairo (AOT) 3.972 ± 0.028 3.924 4.006 1.01 ± 0.01

@codecov-commenter
Copy link

codecov-commenter commented Dec 17, 2024

Codecov Report

Attention: Patch coverage is 91.79191% with 71 lines in your changes missing coverage. Please review.

Project coverage is 80.82%. Comparing base (e47a42e) to head (e2cfe45).

Files with missing lines Patch % Lines
runtime/src/lib.rs 70.40% 37 Missing ⚠️
src/executor/aot.rs 58.62% 12 Missing ⚠️
src/values.rs 95.10% 9 Missing ⚠️
src/bin/cairo-native-stress/main.rs 0.00% 6 Missing ⚠️
src/executor/contract.rs 62.50% 6 Missing ⚠️
src/executor.rs 93.75% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #964      +/-   ##
==========================================
+ Coverage   80.76%   80.82%   +0.06%     
==========================================
  Files         107      108       +1     
  Lines       29256    29749     +493     
==========================================
+ Hits        23628    24046     +418     
- Misses       5628     5703      +75     

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

edg-l
edg-l previously approved these changes Dec 18, 2024
runtime/src/lib.rs Outdated Show resolved Hide resolved
runtime/src/lib.rs Show resolved Hide resolved
edg-l
edg-l previously approved these changes Dec 18, 2024
Comment on lines +33 to +39
find_dict_overrides: impl Copy
+ Fn(
&ConcreteTypeId,
) -> (
Option<extern "C" fn(*mut c_void, *mut c_void)>,
Option<extern "C" fn(*mut c_void)>,
),
Copy link
Contributor

@JulianGCalderon JulianGCalderon Dec 18, 2024

Choose a reason for hiding this comment

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

Could you add a comment explaining why is the argument necessary?

Also, maybe we could define a type alias and use it everywhere else, as it's quite verbose. Do you think it will make it more readable?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We can't make type aliases for impl types in stable Rust yet (it's unstable).

I can add a comment, but I'm not sure where I should add it. I'll add it where we actually use it (in Value::to_ptr).

Copy link
Contributor

@JulianGCalderon JulianGCalderon Dec 18, 2024

Choose a reason for hiding this comment

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

Aah, it's a pity.

Yes, you could add it to Value::to_ptr, and maybe a short mention to it in the trait definition, pointing developers to the Value::to_ptr documentation

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.

4 participants