Re:Automatic Differentiation with Julia
by kristofferc on Tuesday October 23, 2018 @10:56AM
(#18283889)
Julia is pretty good at dealing with this now though
julia> @btime test1(10^5)
147.427 μs (0 allocations: 0 bytes)
99999.1
julia> @btime test2(10^5)
88.472 μs (0 allocations: 0 bytes)
99999.1
In earlier versions of Julia, the penalty here would be order of magnitudes worse.
The following code is type stable:
This code compiles to 14 instructions.