HSU-ANT / ACME.jl

ACME.jl - Analog Circuit Modeling and Emulation for Julia
Other
142 stars 24 forks source link

Improve inferability #78

Closed martinholters closed 2 years ago

martinholters commented 2 years ago

This improves compile time for model generation considerably. E.g. (with Julia 1.6.5):

julia> @time using ACME
  1.456580 seconds (3.10 M allocations: 224.637 MiB, 4.17% compilation time) # main
  1.821829 seconds (3.51 M allocations: 255.264 MiB, 2.87% gc time, 3.40% compilation time) # PR

julia> include(joinpath(pkgdir(ACME), "examples", "diodeclipper.jl"));

julia> @time @eval diodeclipper();
 37.058223 seconds (55.43 M allocations: 3.167 GiB, 3.53% gc time) # main
 24.412586 seconds (25.49 M allocations: 1.448 GiB, 1.12% gc time, 99.96% compilation time) # PR

So the slightly increased load time seems well worth it.

There may be room for further improvements, but this looks sufficiently large and impactful to justify postponing further refinements for now.