I think there's a bug in ThreadsX.map. I initialized Julia with 16 threads.
MWE
using ThreadsX, BenchmarkTools
list1 = rand(50_000_000) .* 100
list2 = rand(50_000_000) .* 100
#OPERATION
foo(x,y) = 100 + x * y + log(x) * 2 / y
with results
@btime ThreadsX.map(foo, list1, list2); #302.361 ms (2771 allocations: 2.39 GiB)
@btime map(foo, list1, list2); # 213.384 ms (4 allocations: 381.47 MiB)
If I run @code_warntype ThreadsX.map(foo, list1, list2);, it shows that the function is type unstable.
REMARK: This is NOT a problem that occurs with ThreadsX.map! or with vmapntt! from LoopVectorization
using LoopVectorization
output = similar(list1)
@btime ThreadsX.map!(foo, output, list1, list2) # 32.265 ms (916 allocations: 88.42 KiB)
@btime vmapntt!(foo, output, list1, list2) # 26.963 ms (0 allocations: 0 bytes)
EDIT: I realized that this seems to be similar to #196 by @bkamins
I think there's a bug in
ThreadsX.map. I initialized Julia with 16 threads.MWE
with results
If I run
@code_warntype ThreadsX.map(foo, list1, list2);, it shows that the function is type unstable.REMARK: This is NOT a problem that occurs with
ThreadsX.map!or withvmapntt!fromLoopVectorizationEDIT: I realized that this seems to be similar to #196 by @bkamins