-
Notifications
You must be signed in to change notification settings - Fork 181
Open
Description
This is related to SciML/ModelingToolkit.jl#2251. Per this comment I would have expected that the compile time only grows with the number of untyped arguments, but that's not necessarily what I am seeing.
For this MWE:
# MWE for @register_symbolic compile time with many arguments
# Related issue: https://github.com/SciML/ModelingToolkit.jl/issues/2251
using ModelingToolkit
using ModelingToolkit: t_nounits as t
# 4 arguments
f4(a::Float64, b::Float64, c, d) = a * b * c * d
println("4 args...")
@time @register_symbolic f4(a::Float64, b::Float64, c, d)::Float64
println("Done!")
# 5 arguments
f5(a::Float64, b::Float64, c::Float64, d, e) = a * b * c * d * e
println("\n5 args...")
@time @register_symbolic f5(a::Float64, b::Float64, c::Float64, d, e)::Float64
println("Done!")
# 6 arguments
f6(a::Float64, b::Float64, c::Float64, d::Float64, e, f) = a * b * c * d * e * f
println("\n6 args...")
@time @register_symbolic f6(a::Float64, b::Float64, c::Float64, d::Float64, e, f)::Float64
println("Done!")
# 7 arguments
f7(a::Float64, b::Float64, c::Float64, d::Float64, e::Float64, f, g) = a * b * c * d * e * f * g
println("\n7 args...")
@time @register_symbolic f7(a::Float64, b::Float64, c::Float64, d::Float64, e::Float64, f, g)::Float64
println("Done!")
# 8 arguments
f8(a::Float64, b::Float64, c::Float64, d::Float64, e::Float64, f::Float64, g, h) = a * b * c * d * e * f * g * h
println("\n8 args...")
@time @register_symbolic f8(a::Float64, b::Float64, c::Float64, d::Float64, e::Float64, f::Float64, g, h)::Float64
println("Done!")
println("\n=== Complete ===")I get
4 args...
0.003894 seconds (1.43 k allocations: 113.828 KiB)
Done!
5 args...
0.010812 seconds (4.26 k allocations: 355.781 KiB)
Done!
6 args...
0.031935 seconds (12.87 k allocations: 1.095 MiB)
Done!
7 args...
0.088620 seconds (38.96 k allocations: 3.423 MiB)
Done!
8 args...
0.270817 seconds (117.89 k allocations: 10.779 MiB)
Done!
=== Complete ===
125.014434 seconds (4.62 M allocations: 193.999 MiB, 0.26% gc time, 96.22% compilation time)If I don't include the 8 argument case, the total runtime is ~11 seconds.
So there still seems to be some exponential scaling going on with the total number of arguments.
Is this a bug or is this expected?
This is with Symbolics v7.2.0.
Note that on Symbolics v6.57.0 without including the 8 argument case, it took ~192 seconds to run. So at least it got considerably better.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels