Use StaticArrays in Binary Subdivision #141
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The resulting
binary_subdivision
function was encountering some performance regressions from the use of batched updates by using iterators. I've kept the batching but instead use StaticArrays to avoid intermediate allocations. While the resulting code isn't quite as a fast as the original, non-batched code, it is fairly close.For triangulated_grid, 150 x 150 length, with 1 grid spacing:
Original (non-batched)
31.626 ms (1239233 allocations: 129.83 MiB)
Original (batched with Iterators)
53.896 ms (2320433 allocations: 173.13 MiB)
Current (batched with SVector)
35.341 ms (1239233 allocations: 129.83 MiB)