Func compose(∘) is slow

newbie here, so code_lowered and code_llvm is magic for me atm, but can somebody explain this pls(1.5.1)?
julia> using Dates
julia> n = 1_000_000
julia> @time map(x->Time(Nanosecond(x)), rand(Int64, n));
0.069440 seconds (45.63 k allocations: 17.583 MiB, 10.79% gc time)
julia> @time map(Time∘Nanosecond, rand(Int64, n));
1.629330 seconds (3.00 M allocations: 61.035 MiB, 0.31% gc time)

1 Like

I think this is fixed on master. Presumably the problem is that compose does not specialize on types in 1.5. https://github.com/JuliaLang/julia/pull/35980

3 Likes

Indeed! on nightly:
julia> @time map(Time∘Nanosecond, rand(Int64, n));
0.013052 seconds (6 allocations: 15.259 MiB)
TYVM