JuliaSymbolics / SymbolicUtils.jl

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

better ordering of terms #549

Closed shashi closed 10 months ago

shashi commented 10 months ago
julia> expand((x+y-1)^4)
1 - 4x - 4y + 6(x^2) + 12x*y + 6(y^2) - 4(x^3) - 12(x^2)*y - 12x*(y^2) - 4(y^3) + x^4 + 4(x^3)*y + 6(x^2)*(y^2) + 4x*(y^3) + y^4

arguments no more uses <ₑ; <ₑ does still maintain a total order, is tested, and used for simplification in non-canonical cases.

github-actions[bot] commented 10 months ago

Benchmark Results

master f0cfce0e675b2a... t[master]/t[f0cfce0e675b2a...]
overhead/acrule/a+2 1.08 ± 0.24 μs 1.08 ± 0.25 μs 1
overhead/acrule/a+2+b 1.07 ± 0.24 μs 1.07 ± 0.25 μs 1
overhead/acrule/a+b 0.358 ± 0.0073 μs 0.358 ± 0.0087 μs 1
overhead/acrule/noop:Int 26.4 ± 0.9 ns 26.2 ± 0.7 ns 1.01
overhead/acrule/noop:Sym 0.0539 ± 0.0083 μs 0.0557 ± 0.0076 μs 0.969
overhead/rule/noop:Int 0.0472 ± 0.0022 μs 0.0453 ± 0.0022 μs 1.04
overhead/rule/noop:Sym 0.0589 ± 0.003 μs 0.0596 ± 0.003 μs 0.987
overhead/rule/noop:Term 0.0592 ± 0.0029 μs 0.0594 ± 0.0029 μs 0.997
overhead/ruleset/noop:Int 0.167 ± 0.0032 μs 0.167 ± 0.0024 μs 0.999
overhead/ruleset/noop:Sym 0.2 ± 0.0067 μs 0.203 ± 0.007 μs 0.984
overhead/ruleset/noop:Term 4.41 ± 0.29 μs 4.41 ± 0.33 μs 1
overhead/simplify/noop:Int 0.217 ± 0.0088 μs 0.221 ± 0.0092 μs 0.98
overhead/simplify/noop:Sym 0.231 ± 0.0053 μs 0.247 ± 0.0055 μs 0.935
overhead/simplify/noop:Term 0.0468 ± 0.0037 ms 0.0462 ± 0.0036 ms 1.01
overhead/simplify/randterm (+, *):serial 0.13 ± 0.0021 s 0.167 ± 0.0015 s 0.781
overhead/simplify/randterm (+, *):thread 0.0789 ± 0.016 s 0.114 ± 0.016 s 0.693
overhead/simplify/randterm (/, *):serial 0.288 ± 0.01 ms 0.285 ± 0.0094 ms 1.01
overhead/simplify/randterm (/, *):thread 0.334 ± 0.011 ms 0.329 ± 0.0098 ms 1.01
overhead/substitute/a 0.0738 ± 0.0021 ms 0.0723 ± 0.0018 ms 1.02
overhead/substitute/a,b 0.0634 ± 0.0021 ms 0.0629 ± 0.0019 ms 1.01
overhead/substitute/a,b,c 21.2 ± 0.7 μs 21.6 ± 0.7 μs 0.981
polyform/easy_iszero 0.0387 ± 0.0032 ms 0.0388 ± 0.0034 ms 0.997
polyform/isone 3.1 ± 0.1 ns 3.1 ± 0.1 ns 1
polyform/iszero 1.63 ± 0.036 ms 2.43 ± 0.032 ms 0.67
polyform/simplify_fractions 2.29 ± 0.04 ms 3.26 ± 0.037 ms 0.703
time_to_load 5.55 ± 0.037 s 5.44 ± 0.015 s 1.02

Benchmark Plots

A plot of the benchmark results have been uploaded as an artifact to the workflow run for this PR. Go to "Actions"->"Benchmark a pull request"->[the most recent run]->"Artifacts" (at the bottom).