tkf / ThreadsX.jl

Parallelized Base functions
MIT License
321 stars 10 forks source link

ThreadsX.sum is not type inferable #182

Closed mohamed82008 closed 2 years ago

mohamed82008 commented 2 years ago

Hi!

Thanks for this really nice package. I noticed that the ThreadsX.sum function can't be inferred properly in Julia 1.6.

julia> @code_warntype ThreadsX.sum(log, rand(100))
Variables
  #self#::Core.Const(ThreadsX.sum)
  f::Core.Const(log)
  itr::Vector{Float64}

Body::Any
1 ─ %1 = Core.NamedTuple()::Core.Const(NamedTuple())
│   %2 = Base.pairs(%1)::Core.Const(Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}())
│   %3 = ThreadsX.Implementations.:(var"#sum#14")(%2, #self#, f, itr)::Any
└──      return %3
tkf commented 2 years ago

I think we can solve this in recent Julia. Let's track this issue in #166 since at the lowest layer it's the same issue.

tkf commented 2 years ago

duplicate of #166