Reduce memory allocations
- Dominant language
- Julia
- Stars
- 18
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
The principal computational cost of the main loop is due to fine-grained memory allocations. These allocations are generally in the `clip` and `split` procedures that allocate new `GeneralPolytope` at each execution.
In order to reduce these allocations, it may be convenient to add an _optional_ cache to `clip` and `split`. The caches must be created outside the main loop of `subtriangulate`. We need to take into account that the number of polytopes per background cell is not bounded. Thus, the cache is indeed an array of caches.
Additionally, it is convenient to eliminate the recursivity of `decompose` using a stack instead.
We note that this is a major refactoring of the code that involve many procedures. In addition, before proceeding, an extensive profiling should be done to identify other memory allocations.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with extensive profiling of the main loop in subtriangulate to identify the dominant memory allocations. Then inspect clip, split, and decompose, including the recursive path and allocations of GeneralPolytope. Done means profiling confirms the target allocations are reduced and decompose no longer relies on recursion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- performance
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100