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

Switch to immutable nodes in expressions #67

Closed
wants to merge 13 commits into from
Closed

Conversation

MilesCranmer
Copy link
Member

Finally got things working with immutable Node{T} types. This makes the codebase much safer and hopefully also more memory efficient. The fields :val, :l, and :r are now RefValue and can be updated, but the others are set at construction time.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 8216463658

Details

  • 40 of 42 (95.24%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.06%) to 94.625%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/Equation.jl 24 25 96.0%
src/SimplifyEquation.jl 14 15 93.33%
Totals Coverage Status
Change from base Build 7996123220: -0.06%
Covered Lines: 1602
Relevant Lines: 1693

💛 - Coveralls

Copy link
Contributor

github-actions bot commented Mar 9, 2024

Benchmark Results

master ad4b372... master/ad4b372f7eb972...
eval/ComplexF32/evaluation 6.97 ± 0.47 ms 7.15 ± 0.45 ms 0.975
eval/ComplexF64/evaluation 9.1 ± 0.69 ms 9.36 ± 0.78 ms 0.972
eval/Float32/derivative 10 ± 1.5 ms 10.4 ± 1.5 ms 0.965
eval/Float32/derivative_turbo 9.98 ± 1.4 ms 10.2 ± 1.5 ms 0.979
eval/Float32/evaluation 2.58 ± 0.24 ms 2.69 ± 0.25 ms 0.96
eval/Float32/evaluation_bumper 0.511 ± 0.019 ms 0.567 ± 0.043 ms 0.901
eval/Float32/evaluation_turbo 0.638 ± 0.039 ms 0.657 ± 0.048 ms 0.97
eval/Float32/evaluation_turbo_bumper 0.511 ± 0.019 ms 0.565 ± 0.042 ms 0.904
eval/Float64/derivative 13.1 ± 0.6 ms 13.2 ± 0.58 ms 0.995
eval/Float64/derivative_turbo 13 ± 0.51 ms 13.3 ± 0.6 ms 0.982
eval/Float64/evaluation 2.79 ± 0.23 ms 2.84 ± 0.25 ms 0.985
eval/Float64/evaluation_bumper 1.12 ± 0.06 ms 1.22 ± 0.067 ms 0.917
eval/Float64/evaluation_turbo 1.1 ± 0.072 ms 1.11 ± 0.071 ms 0.989
eval/Float64/evaluation_turbo_bumper 1.12 ± 0.056 ms 1.22 ± 0.067 ms 0.913
utils/combine_operators/break_sharing 0.0378 ± 0.0022 ms 0.0605 ± 0.0051 ms 0.625
utils/convert/break_sharing 25.7 ± 1.4 μs 0.0516 ± 0.0038 ms 0.498
utils/convert/preserve_sharing 0.118 ± 0.0038 ms 0.259 ± 0.012 ms 0.455
utils/copy/break_sharing 26.6 ± 1.2 μs 0.0518 ± 0.004 ms 0.513
utils/copy/preserve_sharing 0.118 ± 0.0074 ms 0.258 ± 0.018 ms 0.458
utils/count_constants/break_sharing 9.33 ± 0.19 μs 12.4 ± 0.79 μs 0.754
utils/count_constants/preserve_sharing 0.102 ± 0.0034 ms 0.217 ± 0.012 ms 0.471
utils/count_depth/break_sharing 11.6 ± 0.28 μs 18.5 ± 1.5 μs 0.628
utils/count_nodes/break_sharing 9.27 ± 0.27 μs 11.7 ± 0.65 μs 0.794
utils/count_nodes/preserve_sharing 0.104 ± 0.0054 ms 0.221 ± 0.0081 ms 0.472
utils/get_set_constants!/break_sharing 0.0472 ± 0.00098 ms 0.0531 ± 0.0044 ms 0.888
utils/get_set_constants!/preserve_sharing 0.294 ± 0.0095 ms 0.628 ± 0.048 ms 0.469
utils/has_constants/break_sharing 4.38 ± 0.26 μs 5.9 ± 0.47 μs 0.742
utils/has_operators/break_sharing 1.94 ± 0.022 μs 1.91 ± 0.074 μs 1.02
utils/hash/break_sharing 28 ± 0.74 μs 30.4 ± 2.5 μs 0.921
utils/hash/preserve_sharing 0.122 ± 0.0038 ms 0.237 ± 0.019 ms 0.514
utils/index_constants/break_sharing 24.9 ± 0.77 μs 28.5 ± 2.3 μs 0.873
utils/index_constants/preserve_sharing 0.117 ± 0.0068 ms 0.233 ± 0.018 ms 0.503
utils/is_constant/break_sharing 4.36 ± 0.23 μs 5.83 ± 0.5 μs 0.748
utils/simplify_tree/break_sharing 0.169 ± 0.017 ms 0.0924 ± 0.0087 ms 1.83
utils/simplify_tree/preserve_sharing 0.275 ± 0.02 ms 0.304 ± 0.016 ms 0.906
utils/string_tree/break_sharing 0.457 ± 0.029 ms 0.472 ± 0.033 ms 0.968
utils/string_tree/preserve_sharing 0.591 ± 0.029 ms 0.71 ± 0.048 ms 0.833
time_to_load 0.177 ± 0.0018 s 0.189 ± 0.0037 s 0.938

@MilesCranmer
Copy link
Member Author

Wow, this hurts performance by quite a bit! Nevermind then, seems like it's not a good approach.

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