Skip to content

Avoid float in symbolic integer powers when not necessary#942

Open
fgerick wants to merge 1 commit into
JuliaSymbolics:masterfrom
fgerick:master
Open

Avoid float in symbolic integer powers when not necessary#942
fgerick wants to merge 1 commit into
JuliaSymbolics:masterfrom
fgerick:master

Conversation

@fgerick
Copy link
Copy Markdown

@fgerick fgerick commented May 28, 2026

This fixes JuliaSymbolics/Symbolics.jl#1875, which is nice for exact simplifications of larger expressions.

@github-actions
Copy link
Copy Markdown
Contributor

Benchmark Results (Julia vlts)

Time benchmarks
master b1d5200... master / b1d5200...
arithmetic/2-arg mul 10.8 ± 0.24 μs 10.9 ± 0.29 μs 0.99 ± 0.035
arithmetic/addition 0.0663 ± 0.00085 ms 0.0651 ± 0.0008 ms 1.02 ± 0.018
arithmetic/division 24.3 ± 0.64 μs 24.9 ± 0.73 μs 0.978 ± 0.039
arithmetic/multiplication 0.0404 ± 0.0021 ms 0.04 ± 0.0015 ms 1.01 ± 0.065
codegen/arrayop_nested/fast_toexpr 9.7 ± 1.1 μs 9.61 ± 1.1 μs 1.01 ± 0.17
codegen/arrayop_nested/toexpr 0.0667 ± 0.0045 ms 0.0655 ± 0.0032 ms 1.02 ± 0.085
codegen/deep_poly/deg=10:fast_toexpr 0.082 ± 0.0085 ms 0.0803 ± 0.0067 ms 1.02 ± 0.14
codegen/deep_poly/deg=10:toexpr 0.0751 ± 0.0034 ms 0.0783 ± 0.0044 ms 0.96 ± 0.069
codegen/deep_poly/deg=14:fast_toexpr 0.166 ± 0.015 ms 0.165 ± 0.013 ms 1.01 ± 0.12
codegen/deep_poly/deg=14:toexpr 0.137 ± 0.011 ms 0.142 ± 0.011 ms 0.963 ± 0.11
codegen/deep_poly/deg=6:fast_toexpr 0.0343 ± 0.0032 ms 0.0345 ± 0.003 ms 0.994 ± 0.13
codegen/deep_poly/deg=6:toexpr 0.0325 ± 0.0011 ms 0.0338 ± 0.0026 ms 0.959 ± 0.082
codegen/makearray/n=100:fast_toexpr 0.0918 ± 0.011 ms 0.092 ± 0.009 ms 0.998 ± 0.15
codegen/makearray/n=100:toexpr 0.675 ± 0.022 ms 0.661 ± 0.022 ms 1.02 ± 0.048
codegen/makearray/n=200:fast_toexpr 0.157 ± 0.016 ms 0.158 ± 0.014 ms 0.992 ± 0.13
codegen/makearray/n=200:toexpr 0.955 ± 0.023 ms 0.934 ± 0.022 ms 1.02 ± 0.034
codegen/makearray/n=400:fast_toexpr 0.288 ± 0.026 ms 0.29 ± 0.024 ms 0.993 ± 0.12
codegen/makearray/n=400:toexpr 1.52 ± 0.038 ms 1.49 ± 0.036 ms 1.02 ± 0.036
codegen/wide_deep_poly/fast_toexpr 0.585 ± 0.03 ms 0.589 ± 0.026 ms 0.992 ± 0.068
codegen/wide_deep_poly/toexpr 0.502 ± 0.019 ms 0.52 ± 0.019 ms 0.965 ± 0.05
codegen/wide_poly/n=100:fast_toexpr 0.299 ± 0.018 ms 0.295 ± 0.016 ms 1.01 ± 0.081
codegen/wide_poly/n=100:toexpr 0.295 ± 0.021 ms 0.287 ± 0.018 ms 1.03 ± 0.097
codegen/wide_poly/n=25:fast_toexpr 0.0559 ± 0.0065 ms 0.0568 ± 0.0054 ms 0.985 ± 0.15
codegen/wide_poly/n=25:toexpr 0.0703 ± 0.0057 ms 0.0687 ± 0.0051 ms 1.02 ± 0.11
codegen/wide_poly/n=50:fast_toexpr 0.135 ± 0.012 ms 0.135 ± 0.011 ms 0.996 ± 0.12
codegen/wide_poly/n=50:toexpr 0.142 ± 0.013 ms 0.14 ± 0.011 ms 1.01 ± 0.12
irstructure/search_variables/common:IRStructure 0.246 ± 0.01 ms 0.259 ± 0.012 ms 0.947 ± 0.06
irstructure/search_variables/common:reference 0.47 ± 0.11 ms 0.594 ± 0.022 ms 0.791 ± 0.19
irstructure/search_variables/dissimilar:IRStructure 0.0681 ± 0.0047 ms 0.0758 ± 0.0056 ms 0.898 ± 0.091
irstructure/search_variables/dissimilar:reference 0.161 ± 0.027 ms 0.174 ± 0.0046 ms 0.921 ± 0.15
irstructure/substitute/IRSubstituter 8.73 ± 0.54 ms 8.11 ± 0.15 ms 1.08 ± 0.069
irstructure/substitute/reference 8.77 ± 0.14 ms 8.82 ± 0.098 ms 0.994 ± 0.019
irstructure/substitute/sparse IRSubstituter 1.38 ± 0.023 ms 1.4 ± 0.021 ms 0.984 ± 0.022
irstructure/substitute/sparse reference 2.06 ± 0.037 ms 1.98 ± 0.022 ms 1.04 ± 0.022
overhead/acrule/a+2 2.47 ± 0.049 μs 2.51 ± 0.049 μs 0.984 ± 0.027
overhead/acrule/a+2+b 0.07 ± 0 μs 0.06 ± 0 μs 1.17 ± 0
overhead/acrule/a+b 4.41 ± 0.08 μs 4.48 ± 0.1 μs 0.984 ± 0.028
overhead/acrule/noop:Int 0.05 ± 0.01 μs 0.05 ± 0.01 μs 1 ± 0.28
overhead/acrule/noop:Sym 0.06 ± 0.001 μs 0.05 ± 0.001 μs 1.2 ± 0.031
overhead/get_degrees/large_poly 0.07 ± 0.001 μs 0.08 ± 0 μs 0.875 ± 0.012
overhead/rule/noop:Int 0.06 ± 0 μs 0.06 ± 0 μs 1 ± 0
overhead/rule/noop:Sym 0.06 ± 0 μs 0.06 ± 0 μs 1 ± 0
overhead/rule/noop:Term 0.06 ± 0 μs 0.06 ± 0 μs 1 ± 0
overhead/ruleset/noop:Int 30 ± 0 ns 30 ± 0 ns 1 ± 0
overhead/ruleset/noop:Sym 0.271 ± 0.011 μs 0.27 ± 0.001 μs 1 ± 0.041
overhead/ruleset/noop:Term 1.17 ± 0.01 μs 1.15 ± 0.019 μs 1.02 ± 0.019
overhead/simplify/noop:Int 30 ± 0 ns 30 ± 0 ns 1 ± 0
overhead/simplify/noop:Sym 30 ± 10 ns 30 ± 10 ns 1 ± 0.47
overhead/simplify/noop:Term 30.8 ± 1.1 μs 31.2 ± 1.5 μs 0.987 ± 0.058
overhead/simplify/randterm (+, *):serial 0.298 ± 0.0072 s 0.31 ± 0.0073 s 0.961 ± 0.033
overhead/simplify/randterm (+, *):thread 0.327 ± 0.014 s 0.342 ± 0.0079 s 0.956 ± 0.045
overhead/simplify/randterm (/, *):serial 0.186 ± 0.015 ms 0.187 ± 0.014 ms 0.996 ± 0.11
overhead/simplify/randterm (/, *):thread 0.192 ± 0.014 ms 0.191 ± 0.014 ms 1 ± 0.1
overhead/substitute/a 0.0352 ± 0.0013 ms 0.0377 ± 0.0013 ms 0.932 ± 0.048
overhead/substitute/a,b 0.043 ± 0.0012 ms 0.0464 ± 0.0013 ms 0.926 ± 0.037
overhead/substitute/a,b,c 0.0409 ± 0.00094 ms 0.0434 ± 0.0011 ms 0.942 ± 0.032
polyform/easy_iszero 18.1 ± 0.41 μs 18.1 ± 0.4 μs 0.998 ± 0.032
polyform/isone 1.01 ± 0.033 ms 0.996 ± 0.036 ms 1.01 ± 0.05
polyform/isone:noop 0.07 ± 0.01 μs 0.071 ± 0.01 μs 0.986 ± 0.2
polyform/iszero 0.859 ± 0.029 ms 0.848 ± 0.031 ms 1.01 ± 0.05
polyform/iszero:noop 0.08 ± 0.01 μs 0.08 ± 0.01 μs 1 ± 0.18
polyform/simplify_fractions 1.08 ± 0.037 ms 1.08 ± 0.042 ms 1 ± 0.052
printing/large_poly 0.226 ± 0.0016 s 0.219 ± 0.0012 s 1.03 ± 0.0092
time_to_load 1.35 ± 0.019 s 1.35 ± 0.0043 s 0.999 ± 0.014
Memory benchmarks
master b1d5200... master / b1d5200...
arithmetic/2-arg mul 0.067 k allocs: 2.3 kB 0.066 k allocs: 2.27 kB 1.01
arithmetic/addition 0.251 k allocs: 8.08 kB 0.251 k allocs: 8.08 kB 1
arithmetic/division 0.13 k allocs: 5.03 kB 0.128 k allocs: 4.97 kB 1.01
arithmetic/multiplication 0.254 k allocs: 7 kB 0.254 k allocs: 7 kB 1
codegen/arrayop_nested/fast_toexpr 0.189 k allocs: 11.2 kB 0.183 k allocs: 11.1 kB 1.01
codegen/arrayop_nested/toexpr 0.473 k allocs: 20.5 kB 0.467 k allocs: 20.4 kB 1
codegen/deep_poly/deg=10:fast_toexpr 0.975 k allocs: 0.0564 MB 0.975 k allocs: 0.0564 MB 1
codegen/deep_poly/deg=10:toexpr 1.05 k allocs: 0.0497 MB 1.05 k allocs: 0.0497 MB 1
codegen/deep_poly/deg=14:fast_toexpr 1.71 k allocs: 0.117 MB 1.71 k allocs: 0.117 MB 1
codegen/deep_poly/deg=14:toexpr 1.89 k allocs: 0.093 MB 1.89 k allocs: 0.093 MB 1
codegen/deep_poly/deg=6:fast_toexpr 0.447 k allocs: 31.4 kB 0.447 k allocs: 31.4 kB 1
codegen/deep_poly/deg=6:toexpr 0.449 k allocs: 22.9 kB 0.449 k allocs: 22.9 kB 1
codegen/makearray/n=100:fast_toexpr 1.35 k allocs: 0.0703 MB 1.34 k allocs: 0.0702 MB 1
codegen/makearray/n=100:toexpr 4.43 k allocs: 0.173 MB 4.42 k allocs: 0.173 MB 1
codegen/makearray/n=200:fast_toexpr 2.38 k allocs: 0.118 MB 2.37 k allocs: 0.118 MB 1
codegen/makearray/n=200:toexpr 6.36 k allocs: 0.246 MB 6.34 k allocs: 0.245 MB 1
codegen/makearray/n=400:fast_toexpr 4.25 k allocs: 0.214 MB 4.22 k allocs: 0.213 MB 1
codegen/makearray/n=400:toexpr 10.2 k allocs: 0.392 MB 10.1 k allocs: 0.391 MB 1
codegen/wide_deep_poly/fast_toexpr 5.56 k allocs: 0.3 MB 5.56 k allocs: 0.3 MB 1
codegen/wide_deep_poly/toexpr 6.88 k allocs: 0.319 MB 6.88 k allocs: 0.319 MB 1
codegen/wide_poly/n=100:fast_toexpr 2.98 k allocs: 0.178 MB 2.98 k allocs: 0.178 MB 1
codegen/wide_poly/n=100:toexpr 3.92 k allocs: 0.168 MB 3.92 k allocs: 0.168 MB 1
codegen/wide_poly/n=25:fast_toexpr 0.779 k allocs: 0.0464 MB 0.779 k allocs: 0.0464 MB 1
codegen/wide_poly/n=25:toexpr 0.993 k allocs: 0.0428 MB 0.993 k allocs: 0.0428 MB 1
codegen/wide_poly/n=50:fast_toexpr 1.52 k allocs: 0.109 MB 1.52 k allocs: 0.109 MB 1
codegen/wide_poly/n=50:toexpr 1.97 k allocs: 0.0883 MB 1.97 k allocs: 0.0883 MB 1
irstructure/search_variables/common:IRStructure 0.06 k allocs: 7.03 kB 0.06 k allocs: 7.03 kB 1
irstructure/search_variables/common:reference 0.08 k allocs: 0.238 MB 0.1 k allocs: 0.863 MB 0.275
irstructure/search_variables/dissimilar:IRStructure 0.051 k allocs: 6.22 kB 0.051 k allocs: 6.22 kB 1
irstructure/search_variables/dissimilar:reference 0.068 k allocs: 0.0839 MB 0.07 k allocs: 0.104 MB 0.809
irstructure/substitute/IRSubstituter 29.6 k allocs: 1.03 MB 29.6 k allocs: 1.03 MB 1
irstructure/substitute/reference 0.0349 M allocs: 1.24 MB 0.0323 M allocs: 1.19 MB 1.03
irstructure/substitute/sparse IRSubstituter 3.41 k allocs: 0.12 MB 3.41 k allocs: 0.12 MB 1
irstructure/substitute/sparse reference 8.74 k allocs: 0.328 MB 6.08 k allocs: 0.287 MB 1.14
overhead/acrule/a+2 0.034 k allocs: 1.25 kB 0.033 k allocs: 1.23 kB 1.01
overhead/acrule/a+2+b 0 allocs: 0 B 0 allocs: 0 B
overhead/acrule/a+b 0.047 k allocs: 1.8 kB 0.045 k allocs: 1.77 kB 1.02
overhead/acrule/noop:Int 0 allocs: 0 B 0 allocs: 0 B
overhead/acrule/noop:Sym 0 allocs: 0 B 0 allocs: 0 B
overhead/get_degrees/large_poly 2 allocs: 32 B 2 allocs: 32 B 1
overhead/rule/noop:Int 2 allocs: 0.0625 kB 2 allocs: 0.0625 kB 1
overhead/rule/noop:Sym 2 allocs: 0.0625 kB 2 allocs: 0.0625 kB 1
overhead/rule/noop:Term 2 allocs: 0.0625 kB 2 allocs: 0.0625 kB 1
overhead/ruleset/noop:Int 0 allocs: 0 B 0 allocs: 0 B
overhead/ruleset/noop:Sym 3 allocs: 0.109 kB 3 allocs: 0.109 kB 1
overhead/ruleset/noop:Term 12 allocs: 0.391 kB 12 allocs: 0.391 kB 1
overhead/simplify/noop:Int 0 allocs: 0 B 0 allocs: 0 B
overhead/simplify/noop:Sym 0 allocs: 0 B 0 allocs: 0 B
overhead/simplify/noop:Term 0.298 k allocs: 11.5 kB 0.282 k allocs: 11.3 kB 1.02
overhead/simplify/randterm (+, *):serial 2.5 M allocs: 0.0954 GB 2.4 M allocs: 0.0938 GB 1.02
overhead/simplify/randterm (+, *):thread 2.56 M allocs: 0.253 GB 2.45 M allocs: 0.252 GB 1.01
overhead/simplify/randterm (/, *):serial 2.04 k allocs: 0.0733 MB 1.91 k allocs: 0.0713 MB 1.03
overhead/simplify/randterm (/, *):thread 2.07 k allocs: 0.0743 MB 1.95 k allocs: 0.0724 MB 1.03
overhead/substitute/a 0.158 k allocs: 5.78 kB 0.158 k allocs: 5.78 kB 1
overhead/substitute/a,b 0.201 k allocs: 7.25 kB 0.201 k allocs: 7.25 kB 1
overhead/substitute/a,b,c 0.203 k allocs: 7.22 kB 0.203 k allocs: 7.22 kB 1
polyform/easy_iszero 0.105 k allocs: 3.41 kB 0.099 k allocs: 3.31 kB 1.03
polyform/isone 7.67 k allocs: 0.55 MB 7.32 k allocs: 0.544 MB 1.01
polyform/isone:noop 1 allocs: 16 B 1 allocs: 16 B 1
polyform/iszero 6.27 k allocs: 0.457 MB 6.11 k allocs: 0.454 MB 1.01
polyform/iszero:noop 1 allocs: 16 B 1 allocs: 16 B 1
polyform/simplify_fractions 8.07 k allocs: 0.57 MB 7.9 k allocs: 0.567 MB 1.01
printing/large_poly 1.86 M allocs: 0.082 GB 1.86 M allocs: 0.082 GB 1
time_to_load 0.153 k allocs: 14.5 kB 0.153 k allocs: 14.5 kB 1

@github-actions
Copy link
Copy Markdown
Contributor

Benchmark Results (Julia v1)

Time benchmarks
master b1d5200... master / b1d5200...
arithmetic/2-arg mul 10.1 ± 0.36 μs 10.2 ± 0.25 μs 0.985 ± 0.043
arithmetic/addition 0.0562 ± 0.00086 ms 0.0568 ± 0.00063 ms 0.991 ± 0.019
arithmetic/division 23.9 ± 0.71 μs 23.6 ± 0.5 μs 1.01 ± 0.037
arithmetic/multiplication 0.0398 ± 0.0017 ms 0.0386 ± 0.0016 ms 1.03 ± 0.06
codegen/arrayop_nested/fast_toexpr 7.9 ± 0.51 μs 7.81 ± 0.43 μs 1.01 ± 0.086
codegen/arrayop_nested/toexpr 0.0567 ± 0.0015 ms 0.0586 ± 0.0019 ms 0.967 ± 0.04
codegen/deep_poly/deg=10:fast_toexpr 0.0713 ± 0.0055 ms 0.0736 ± 0.019 ms 0.97 ± 0.26
codegen/deep_poly/deg=10:toexpr 0.0736 ± 0.019 ms 0.0784 ± 0.02 ms 0.938 ± 0.35
codegen/deep_poly/deg=14:fast_toexpr 0.164 ± 0.024 ms 0.159 ± 0.024 ms 1.03 ± 0.22
codegen/deep_poly/deg=14:toexpr 0.135 ± 0.038 ms 0.145 ± 0.037 ms 0.929 ± 0.35
codegen/deep_poly/deg=6:fast_toexpr 31.1 ± 4.7 μs 30.3 ± 5.9 μs 1.03 ± 0.25
codegen/deep_poly/deg=6:toexpr 31.6 ± 0.69 μs 0.0337 ± 0.0012 ms 0.935 ± 0.039
codegen/makearray/n=100:fast_toexpr 0.119 ± 0.033 ms 0.111 ± 0.035 ms 1.07 ± 0.44
codegen/makearray/n=100:toexpr 0.603 ± 0.069 ms 0.622 ± 0.067 ms 0.969 ± 0.15
codegen/makearray/n=200:fast_toexpr 0.179 ± 0.049 ms 0.174 ± 0.044 ms 1.03 ± 0.39
codegen/makearray/n=200:toexpr 1.03 ± 0.12 ms 1.06 ± 0.13 ms 0.969 ± 0.17
codegen/makearray/n=400:fast_toexpr 0.342 ± 0.038 ms 0.337 ± 0.041 ms 1.02 ± 0.17
codegen/makearray/n=400:toexpr 1.69 ± 0.23 ms 1.75 ± 0.22 ms 0.97 ± 0.18
codegen/wide_deep_poly/fast_toexpr 0.632 ± 0.029 ms 0.606 ± 0.026 ms 1.04 ± 0.065
codegen/wide_deep_poly/toexpr 0.495 ± 0.018 ms 0.523 ± 0.015 ms 0.946 ± 0.044
codegen/wide_poly/n=100:fast_toexpr 0.248 ± 0.02 ms 0.241 ± 0.016 ms 1.03 ± 0.11
codegen/wide_poly/n=100:toexpr 0.292 ± 0.028 ms 0.3 ± 0.023 ms 0.973 ± 0.12
codegen/wide_poly/n=25:fast_toexpr 0.0463 ± 0.016 ms 0.0454 ± 0.017 ms 1.02 ± 0.53
codegen/wide_poly/n=25:toexpr 0.0703 ± 0.017 ms 0.0715 ± 0.017 ms 0.983 ± 0.33
codegen/wide_poly/n=50:fast_toexpr 0.107 ± 0.017 ms 0.109 ± 0.013 ms 0.986 ± 0.2
codegen/wide_poly/n=50:toexpr 0.142 ± 0.035 ms 0.146 ± 0.034 ms 0.967 ± 0.33
irstructure/search_variables/common:IRStructure 0.236 ± 0.008 ms 0.241 ± 0.01 ms 0.977 ± 0.052
irstructure/search_variables/common:reference 0.783 ± 0.016 ms 0.795 ± 0.016 ms 0.986 ± 0.028
irstructure/search_variables/dissimilar:IRStructure 0.066 ± 0.0045 ms 0.0662 ± 0.0029 ms 0.996 ± 0.081
irstructure/search_variables/dissimilar:reference 0.251 ± 0.02 ms 0.245 ± 0.021 ms 1.03 ± 0.12
irstructure/substitute/IRSubstituter 8.6 ± 0.56 ms 7.48 ± 0.25 ms 1.15 ± 0.084
irstructure/substitute/reference 8.9 ± 0.97 ms 7.79 ± 0.26 ms 1.14 ± 0.13
irstructure/substitute/sparse IRSubstituter 1.31 ± 0.032 ms 1.3 ± 0.028 ms 1.01 ± 0.033
irstructure/substitute/sparse reference 1.71 ± 0.028 ms 1.66 ± 0.022 ms 1.03 ± 0.022
overhead/acrule/a+2 2.43 ± 0.081 μs 2.44 ± 0.061 μs 0.992 ± 0.041
overhead/acrule/a+2+b 0.07 ± 0.01 μs 0.071 ± 0.01 μs 0.986 ± 0.2
overhead/acrule/a+b 4.37 ± 0.15 μs 4.38 ± 0.1 μs 0.998 ± 0.041
overhead/acrule/noop:Int 30 ± 0 ns 30 ± 0 ns 1 ± 0
overhead/acrule/noop:Sym 0.06 ± 0 μs 0.06 ± 0 μs 1 ± 0
overhead/get_degrees/large_poly 0.09 ± 0.01 μs 0.08 ± 0 μs 1.12 ± 0.12
overhead/rule/noop:Int 0.06 ± 0.01 μs 0.06 ± 0.01 μs 1 ± 0.24
overhead/rule/noop:Sym 0.07 ± 0.01 μs 0.06 ± 0.01 μs 1.17 ± 0.26
overhead/rule/noop:Term 0.07 ± 0.01 μs 0.06 ± 0.01 μs 1.17 ± 0.26
overhead/ruleset/noop:Int 30 ± 0 ns 30 ± 0 ns 1 ± 0
overhead/ruleset/noop:Sym 0.34 ± 0.01 μs 0.311 ± 0.03 μs 1.09 ± 0.11
overhead/ruleset/noop:Term 1.23 ± 0.02 μs 1.19 ± 0.04 μs 1.03 ± 0.039
overhead/simplify/noop:Int 30 ± 0 ns 30 ± 0 ns 1 ± 0
overhead/simplify/noop:Sym 30 ± 10 ns 30 ± 10 ns 1 ± 0.47
overhead/simplify/noop:Term 29.3 ± 0.66 μs 29.8 ± 0.65 μs 0.984 ± 0.031
overhead/simplify/randterm (+, *):serial 0.292 ± 0.032 s 0.294 ± 0.03 s 0.992 ± 0.15
overhead/simplify/randterm (+, *):thread 0.34 ± 0.099 s 0.34 ± 0.028 s 1 ± 0.3
overhead/simplify/randterm (/, *):serial 0.178 ± 0.019 ms 0.181 ± 0.022 ms 0.986 ± 0.16
overhead/simplify/randterm (/, *):thread 0.194 ± 0.029 ms 0.195 ± 0.028 ms 0.996 ± 0.21
overhead/substitute/a 31.1 ± 0.73 μs 31.6 ± 0.66 μs 0.984 ± 0.031
overhead/substitute/a,b 0.0387 ± 0.00089 ms 0.039 ± 0.00074 ms 0.994 ± 0.03
overhead/substitute/a,b,c 0.0373 ± 0.00088 ms 0.0377 ± 0.00078 ms 0.99 ± 0.031
polyform/easy_iszero 16.1 ± 0.45 μs 16.2 ± 0.38 μs 0.991 ± 0.036
polyform/isone 0.906 ± 0.022 ms 0.895 ± 0.015 ms 1.01 ± 0.03
polyform/isone:noop 0.07 ± 0.01 μs 0.07 ± 0.001 μs 1 ± 0.14
polyform/iszero 0.79 ± 0.022 ms 0.777 ± 0.016 ms 1.02 ± 0.036
polyform/iszero:noop 0.07 ± 0.01 μs 0.08 ± 0.009 μs 0.875 ± 0.16
polyform/simplify_fractions 0.984 ± 0.02 ms 0.971 ± 0.015 ms 1.01 ± 0.026
printing/large_poly 0.214 ± 0.022 s 0.207 ± 0.02 s 1.03 ± 0.14
time_to_load 1.43 ± 0.027 s 1.33 ± 0.0036 s 1.08 ± 0.02
Memory benchmarks
master b1d5200... master / b1d5200...
arithmetic/2-arg mul 0.06 k allocs: 1.84 kB 0.06 k allocs: 1.84 kB 1
arithmetic/addition 0.251 k allocs: 7.75 kB 0.251 k allocs: 7.75 kB 1
arithmetic/division 0.134 k allocs: 4.8 kB 0.134 k allocs: 4.8 kB 1
arithmetic/multiplication 0.254 k allocs: 6.53 kB 0.254 k allocs: 6.53 kB 1
codegen/arrayop_nested/fast_toexpr 0.203 k allocs: 9.53 kB 0.203 k allocs: 9.53 kB 1
codegen/arrayop_nested/toexpr 0.524 k allocs: 19.7 kB 0.524 k allocs: 19.7 kB 1
codegen/deep_poly/deg=10:fast_toexpr 1.25 k allocs: 0.0565 MB 1.25 k allocs: 0.0565 MB 1
codegen/deep_poly/deg=10:toexpr 1.41 k allocs: 0.0488 MB 1.41 k allocs: 0.0488 MB 1
codegen/deep_poly/deg=14:fast_toexpr 2.22 k allocs: 0.12 MB 2.22 k allocs: 0.12 MB 1
codegen/deep_poly/deg=14:toexpr 2.55 k allocs: 0.0908 MB 2.55 k allocs: 0.0908 MB 1
codegen/deep_poly/deg=6:fast_toexpr 0.561 k allocs: 28.9 kB 0.561 k allocs: 28.9 kB 1
codegen/deep_poly/deg=6:toexpr 0.601 k allocs: 22.2 kB 0.601 k allocs: 22.2 kB 1
codegen/makearray/n=100:fast_toexpr 1.98 k allocs: 0.0835 MB 1.98 k allocs: 0.0835 MB 1
codegen/makearray/n=100:toexpr 4.86 k allocs: 0.169 MB 4.86 k allocs: 0.169 MB 1
codegen/makearray/n=200:fast_toexpr 3.22 k allocs: 0.135 MB 3.22 k allocs: 0.135 MB 1
codegen/makearray/n=200:toexpr 8.39 k allocs: 0.291 MB 8.39 k allocs: 0.291 MB 1
codegen/makearray/n=400:fast_toexpr 6.34 k allocs: 0.268 MB 6.34 k allocs: 0.268 MB 1
codegen/makearray/n=400:toexpr 13.9 k allocs: 0.473 MB 13.9 k allocs: 0.473 MB 1
codegen/wide_deep_poly/fast_toexpr 7.43 k allocs: 0.352 MB 7.43 k allocs: 0.352 MB 1
codegen/wide_deep_poly/toexpr 9.37 k allocs: 0.327 MB 9.37 k allocs: 0.327 MB 1
codegen/wide_poly/n=100:fast_toexpr 3.5 k allocs: 0.155 MB 3.5 k allocs: 0.155 MB 1
codegen/wide_poly/n=100:toexpr 4.92 k allocs: 0.166 MB 4.92 k allocs: 0.166 MB 1
codegen/wide_poly/n=25:fast_toexpr 0.911 k allocs: 0.0388 MB 0.911 k allocs: 0.0388 MB 1
codegen/wide_poly/n=25:toexpr 1.24 k allocs: 0.0421 MB 1.24 k allocs: 0.0421 MB 1
codegen/wide_poly/n=50:fast_toexpr 1.78 k allocs: 0.0928 MB 1.78 k allocs: 0.0928 MB 1
codegen/wide_poly/n=50:toexpr 2.47 k allocs: 0.0862 MB 2.47 k allocs: 0.0862 MB 1
irstructure/search_variables/common:IRStructure 0.09 k allocs: 6.25 kB 0.09 k allocs: 6.25 kB 1
irstructure/search_variables/common:reference 0.26 k allocs: 0.23 MB 0.26 k allocs: 0.23 MB 1
irstructure/search_variables/dissimilar:IRStructure 0.076 k allocs: 5.5 kB 0.076 k allocs: 5.5 kB 1
irstructure/search_variables/dissimilar:reference 0.155 k allocs: 0.0488 MB 0.154 k allocs: 0.048 MB 1.02
irstructure/substitute/IRSubstituter 31.2 k allocs: 1.01 MB 31.2 k allocs: 1.01 MB 1
irstructure/substitute/reference 0.0338 M allocs: 1.17 MB 0.0338 M allocs: 1.17 MB 1
irstructure/substitute/sparse IRSubstituter 3.63 k allocs: 0.119 MB 3.63 k allocs: 0.119 MB 1
irstructure/substitute/sparse reference 6.3 k allocs: 0.286 MB 6.3 k allocs: 0.286 MB 1
overhead/acrule/a+2 0.032 k allocs: 1.12 kB 0.032 k allocs: 1.12 kB 1
overhead/acrule/a+2+b 0 allocs: 0 B 0 allocs: 0 B
overhead/acrule/a+b 0.042 k allocs: 1.55 kB 0.042 k allocs: 1.55 kB 1
overhead/acrule/noop:Int 0 allocs: 0 B 0 allocs: 0 B
overhead/acrule/noop:Sym 0 allocs: 0 B 0 allocs: 0 B
overhead/get_degrees/large_poly 2 allocs: 32 B 2 allocs: 32 B 1
overhead/rule/noop:Int 2 allocs: 0.0625 kB 2 allocs: 0.0625 kB 1
overhead/rule/noop:Sym 2 allocs: 0.0625 kB 2 allocs: 0.0625 kB 1
overhead/rule/noop:Term 2 allocs: 0.0625 kB 2 allocs: 0.0625 kB 1
overhead/ruleset/noop:Int 0 allocs: 0 B 0 allocs: 0 B
overhead/ruleset/noop:Sym 3 allocs: 0.109 kB 3 allocs: 0.109 kB 1
overhead/ruleset/noop:Term 12 allocs: 0.391 kB 12 allocs: 0.391 kB 1
overhead/simplify/noop:Int 0 allocs: 0 B 0 allocs: 0 B
overhead/simplify/noop:Sym 0 allocs: 0 B 0 allocs: 0 B
overhead/simplify/noop:Term 0.268 k allocs: 9.91 kB 0.268 k allocs: 9.91 kB 1
overhead/simplify/randterm (+, *):serial 2.28 M allocs: 0.0846 GB 2.28 M allocs: 0.0846 GB 1
overhead/simplify/randterm (+, *):thread 2.44 M allocs: 0.247 GB 2.44 M allocs: 0.247 GB 1
overhead/simplify/randterm (/, *):serial 1.84 k allocs: 0.0655 MB 1.84 k allocs: 0.0655 MB 1
overhead/simplify/randterm (/, *):thread 1.98 k allocs: 0.0704 MB 1.98 k allocs: 0.0704 MB 1
overhead/substitute/a 0.164 k allocs: 5.69 kB 0.164 k allocs: 5.69 kB 1
overhead/substitute/a,b 0.211 k allocs: 7.22 kB 0.211 k allocs: 7.22 kB 1
overhead/substitute/a,b,c 0.215 k allocs: 7.31 kB 0.215 k allocs: 7.31 kB 1
polyform/easy_iszero 0.093 k allocs: 2.91 kB 0.093 k allocs: 2.91 kB 1
polyform/isone 11.1 k allocs: 0.57 MB 11.1 k allocs: 0.57 MB 1
polyform/isone:noop 1 allocs: 16 B 1 allocs: 16 B 1
polyform/iszero 9.21 k allocs: 0.474 MB 9.21 k allocs: 0.474 MB 1
polyform/iszero:noop 1 allocs: 16 B 1 allocs: 16 B 1
polyform/simplify_fractions 11.6 k allocs: 0.588 MB 11.6 k allocs: 0.588 MB 1
printing/large_poly 2.15 M allocs: 0.079 GB 2.15 M allocs: 0.079 GB 1
time_to_load 0.145 k allocs: 11 kB 0.145 k allocs: 11 kB 1

@AayushSabharwal
Copy link
Copy Markdown
Member

Thank you! Please add a test so we can know if this behavior regresses. The test should fail without this PR and pass with it.

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.

Expansion of sqrt for integers

2 participants