It seems that tmap is substantially slower than creating a variable output and update it using tmap!. Is this behavior expected or a bug?
function foo(x)
output = similar(x)
tmap!(log, output, x)
end
@btime map(log, $x)
@btime tmap(log, $x)
@btime foo($x)
in my machine gives
# x = rand(1_000_000)
3.185 ms (2 allocations: 7.629 MiB)
3.031 ms (568 allocations: 16.958 MiB)
339.091 μs (152 allocations: 7.642 MiB)
# x = rand(10_000_000)
47.702 ms (2 allocations: 76.294 MiB)
53.858 ms (569 allocations: 222.665 MiB)
4.796 ms (152 allocations: 76.307 MiB)