JuliaSymbolics / SymbolicUtils.jl

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

Refactor: Simplify `@syms` macro implementation #600

Open bowenszhu opened 1 month ago

bowenszhu commented 1 month ago

This PR removes redundant call to _name_type within the @syms macro definition.

github-actions[bot] commented 1 month ago

Benchmark Results

master 52e364d183c29f... master/52e364d183c29f...
overhead/acrule/a+2 0.786 ± 0.02 μs 0.744 ± 0.015 μs 1.06
overhead/acrule/a+2+b 0.76 ± 0.017 μs 0.736 ± 0.018 μs 1.03
overhead/acrule/a+b 0.261 ± 0.0077 μs 0.285 ± 0.0061 μs 0.915
overhead/acrule/noop:Int 25 ± 0.06 ns 25.7 ± 0.12 ns 0.976
overhead/acrule/noop:Sym 0.0364 ± 0.0052 μs 0.0501 ± 0.0056 μs 0.726
overhead/rule/noop:Int 0.044 ± 0.00099 μs 0.0441 ± 0.0012 μs 0.997
overhead/rule/noop:Sym 0.0547 ± 0.0023 μs 0.0548 ± 0.0024 μs 0.997
overhead/rule/noop:Term 0.0545 ± 0.0023 μs 0.0545 ± 0.0021 μs 1
overhead/ruleset/noop:Int 0.132 ± 0.0039 μs 0.133 ± 0.0029 μs 0.995
overhead/ruleset/noop:Sym 0.152 ± 0.0038 μs 0.159 ± 0.0039 μs 0.959
overhead/ruleset/noop:Term 3.85 ± 0.14 μs 3.69 ± 0.14 μs 1.04
overhead/simplify/noop:Int 0.138 ± 0.0033 μs 0.145 ± 0.0035 μs 0.95
overhead/simplify/noop:Sym 0.154 ± 0.0051 μs 0.155 ± 0.0038 μs 0.993
overhead/simplify/noop:Term 0.0378 ± 0.0019 ms 0.0402 ± 0.0021 ms 0.94
overhead/simplify/randterm (+, *):serial 0.121 ± 0.005 s 0.12 ± 0.0053 s 1.01
overhead/simplify/randterm (+, *):thread 0.0743 ± 0.022 s 0.0753 ± 0.023 s 0.987
overhead/simplify/randterm (/, *):serial 0.225 ± 0.0068 ms 0.231 ± 0.007 ms 0.974
overhead/simplify/randterm (/, *):thread 0.256 ± 0.0077 ms 0.264 ± 0.0078 ms 0.968
overhead/substitute/a 0.0617 ± 0.0016 ms 0.0587 ± 0.0015 ms 1.05
overhead/substitute/a,b 0.0544 ± 0.0015 ms 0.0516 ± 0.0015 ms 1.06
overhead/substitute/a,b,c 17.8 ± 0.69 μs 17.2 ± 0.66 μs 1.04
polyform/easy_iszero 0.0345 ± 0.0018 ms 0.0333 ± 0.0018 ms 1.04
polyform/isone 2.79 ± 0.01 ns 2.79 ± 0.01 ns 0.997
polyform/iszero 1.81 ± 0.035 ms 1.76 ± 0.037 ms 1.03
polyform/simplify_fractions 2.43 ± 0.039 ms 2.38 ± 0.048 ms 1.02
time_to_load 4.58 ± 0.016 s 4.56 ± 0.017 s 1

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).