JuliaSymbolics / SymbolicUtils.jl

Symbolic expressions, rewriting and simplification
https://docs.sciml.ai/SymbolicUtils/stable/
Other
536 stars 107 forks source link

Don't specialize. #386

Closed chriselrod closed 1 year ago

chriselrod commented 2 years ago

Thanks to @YingboMa who pair programmed with me on this. On this PR:

┌ Info: expand fuzz
└   iter = 100
┌ Info: expand fuzz
└   iter = 200
┌ Info: expand fuzz
└   iter = 300
┌ Info: expand fuzz
└   iter = 400
┌ Info: expand fuzz
└   iter = 500
 75.783455 seconds (204.67 M allocations: 12.509 GiB, 4.75% gc time, 4.89% compilation time)
┌ Info: simplify_fractions fuzz
└   iter = 100
┌ Info: simplify_fractions fuzz
└   iter = 200
┌ Info: num fuzz
└   iter = 100
┌ Info: num fuzz
└   iter = 200
┌ Info: num fuzz
└   iter = 300
┌ Info: num fuzz
└   iter = 400
┌ Info: num fuzz
└   iter = 500
┌ Info: num fuzz
└   iter = 600
┌ Info: num fuzz
└   iter = 700
┌ Info: num fuzz
└   iter = 800
┌ Info: num fuzz
└   iter = 900
┌ Info: num fuzz
└   iter = 1000
┌ Info: num fuzz
└   iter = 1100
┌ Info: num fuzz
└   iter = 1200
┌ Info: num fuzz
└   iter = 1300
┌ Info: num fuzz
└   iter = 1400
┌ Info: num fuzz
└   iter = 1500
 44.888103 seconds (111.06 M allocations: 6.969 GiB, 4.38% gc time, 0.03% compilation time)
┌ Info: bool fuzz
└   iter = 100
┌ Info: bool fuzz
└   iter = 200
┌ Info: bool fuzz
└   iter = 300
┌ Info: bool fuzz
└   iter = 400
┌ Info: bool fuzz
└   iter = 500
 10.796814 seconds (14.07 M allocations: 827.394 MiB, 2.49% gc time, 90.58% compilation time)
  2.397659 seconds (5.47 M allocations: 324.619 MiB, 3.54% gc time, 98.17% compilation time)
  0.951542 seconds (1.85 M allocations: 109.776 MiB, 2.88% gc time, 43.19% compilation time)
  0.397590 seconds (494.99 k allocations: 28.885 MiB, 7.00% gc time, 92.91% compilation time)
  0.466091 seconds (1.07 M allocations: 61.897 MiB, 44.04% compilation time)
Test Summary: |  Pass  Total
Fuzz test     | 13685  13685
Test Summary:        | Pass  Total
create_array adjoint |   55     55
258.679492 seconds (652.72 M allocations: 39.319 GiB, 4.26% gc time, 6.51% compilation time)
Test.DefaultTestSet("create_array adjoint", Any[], 55, false, false)

Before:

┌ Info: expand fuzz
└   iter = 100
┌ Info: expand fuzz
└   iter = 200
┌ Info: expand fuzz
└   iter = 300
┌ Info: expand fuzz
└   iter = 400
┌ Info: expand fuzz
└   iter = 500
165.876081 seconds (397.69 M allocations: 23.969 GiB, 4.54% gc time, 3.38% compilation time)
┌ Info: simplify_fractions fuzz
└   iter = 100
┌ Info: simplify_fractions fuzz
└   iter = 200
┌ Info: num fuzz
└   iter = 100
┌ Info: num fuzz
└   iter = 200
┌ Info: num fuzz
└   iter = 300
┌ Info: num fuzz
└   iter = 400
┌ Info: num fuzz
└   iter = 500
┌ Info: num fuzz
└   iter = 600
┌ Info: num fuzz
└   iter = 700
┌ Info: num fuzz
└   iter = 800
┌ Info: num fuzz
└   iter = 900
┌ Info: num fuzz
└   iter = 1000
┌ Info: num fuzz
└   iter = 1100
┌ Info: num fuzz
└   iter = 1200
┌ Info: num fuzz
└   iter = 1300
┌ Info: num fuzz
└   iter = 1400
┌ Info: num fuzz
└   iter = 1500
 72.779004 seconds (156.13 M allocations: 9.671 GiB, 3.98% gc time, 0.48% compilation time)
┌ Info: bool fuzz
└   iter = 100
┌ Info: bool fuzz
└   iter = 200
┌ Info: bool fuzz
└   iter = 300
┌ Info: bool fuzz
└   iter = 400
┌ Info: bool fuzz
└   iter = 500
 10.059934 seconds (14.73 M allocations: 865.991 MiB, 4.70% gc time, 91.26% compilation time)
  4.797554 seconds (11.22 M allocations: 673.276 MiB, 4.03% gc time, 98.48% compilation time)
  7.576491 seconds (16.41 M allocations: 985.511 MiB, 4.07% gc time, 28.68% compilation time)
  7.804001 seconds (16.31 M allocations: 981.325 MiB, 3.67% gc time, 98.43% compilation time)
  8.654091 seconds (16.33 M allocations: 982.696 MiB, 2.98% gc time, 37.41% compilation time)
Test Summary: |  Pass  Total
Fuzz test     | 13685  13685
Test Summary:        | Pass  Total
create_array adjoint |   55     55
433.257566 seconds (1.01 G allocations: 60.573 GiB, 4.20% gc time, 7.61% compilation time)
Test.DefaultTestSet("create_array adjoint", Any[], 55, false, false)
codecov-commenter commented 2 years ago

Codecov Report

Merging #386 (8221ebe) into master (ad5664a) will increase coverage by 0.01%. The diff coverage is 87.50%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #386      +/-   ##
==========================================
+ Coverage   83.37%   83.38%   +0.01%     
==========================================
  Files          10       10              
  Lines        1257     1264       +7     
==========================================
+ Hits         1048     1054       +6     
- Misses        209      210       +1     
Impacted Files Coverage Δ
src/methods.jl 79.54% <0.00%> (-1.85%) :arrow_down:
src/types.jl 85.07% <93.33%> (+0.08%) :arrow_up:
src/polyform.jl 92.85% <0.00%> (+0.09%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update ad5664a...8221ebe. Read the comment docs.

chriselrod commented 2 years ago

Whats the path forward on unityping, either through your branch or Unityper?

This is of course a short term improvement at best.

shashi commented 1 year ago

Terrible choice of benchmark :-p. but we did it.