Reduce/remove inner allocations (e.g. `gamma_inc_taylor`, `gamma_inc_asym`)
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 38/100
- Issue type
- Refactor
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- julia
- Domain
- performance
Research direction
Start with the gamma_inc_taylor and gamma_inc_asym functions and reproduce the allocation measurements reported in the issue. Compare the proposed StaticArrays.MVector and per-thread buffer pool approaches, then confirm that the chosen design reduces inner allocations without requiring recompilation.
Written by the indexing model from the issue text.
Description
A performance issue when running many iterations of the gamma function is the internal allocation of a 30-length buffer.
A solution I've implemented is to overwrite the functions to use 1) StaticArrays.MVector, and 2) A per-thread buffer pool. However, I don't know if this is the best solution.
const gamma_inc_taylor_buffers = map(1:nthreadlimit) do i
@MVector zeros(30)
end
function _gamma_inc_get_buffer()
buffer = gamma_inc_taylor_buffers[Threads.threadid()]
buffer .= 0
return buffer
end
# in functions
wk = _gamma_inc_get_buffer()
It would be better to have a solution in here, to avoid recompiling.
4.814791 seconds (14.04 M allocations: 3.806 GiB, 18.75% gc time) # Current
4.496342 seconds (14.04 M allocations: 3.217 GiB, 16.10% gc time) # `@MVector zeros(30)`
3.123370 seconds (869.47 k allocations: 78.309 MiB) # Buffer pool + MVector
- Dominant language
- Julia
- Stars
- 384
- Forks
- 115
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 2
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from JuliaMath/SpecialFunctions.jl
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
JuliaMath/SpecialFunctions.jl#570 ·
-
Difficulty 5/5 Over a week Newbie friendliness 40/100
JuliaMath/SpecialFunctions.jl#569 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
JuliaMath/SpecialFunctions.jl#567 ·
-
Difficulty 4/5 1-2 days Newbie friendliness 56/100
JuliaMath/SpecialFunctions.jl#563 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
JuliaMath/SpecialFunctions.jl#560 ·
All issues in JuliaMath/SpecialFunctions.jl
Similar issues
-
backport 1.14 GC
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
`binary_focal_loss` throws a `DomainError` when a negative sample has `ŷ = 1`Possibly taken @parth-patel010 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
FluxML/Flux.jl#2818 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
JuliaDiff/TaylorSeries.jl#445 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
control-toolbox/CTActions#139 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
SciML/Optimization.jl#1448 ·
Maintainers usually reply within 1 day