Skip to content

Commit

Permalink
Fix the inference error by removing assume_effects
Browse files Browse the repository at this point in the history
We can't actually assume foldable, and it's probably deep enough in the stack that it confuses the compiler.

Measuring performance doesn't seem to show a decrease, so we eat the cost...
  • Loading branch information
asinghvi17 committed Jan 7, 2025
1 parent 39b51f9 commit b3addd0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions GeometryOpsCore/src/apply.jl
Original file line number Diff line number Diff line change
Expand Up @@ -343,9 +343,12 @@ using Base.Threads: nthreads, @threads, @spawn
return mapreduce(fetch, vcat, tasks)
end
#=
Here we use the compiler directive `@assume_effects :foldable` to force the compiler
Here we used to use the compiler directive `@assume_effects :foldable` to force the compiler
to lookup through the closure. This alone makes e.g. `flip` 2.5x faster!
But it caused inference to fail, so we've removed it. No effect on runtime so far as we can tell,
at least in Julia 1.11.
=#
Base.@assume_effects :foldable @inline function _maptasks(f::F, taskrange, threaded::_False)::Vector where F
@inline function _maptasks(f::F, taskrange, threaded::_False)::Vector where F
map(f, taskrange)
end

0 comments on commit b3addd0

Please sign in to comment.