JuliaGeometry / Contour.jl

Calculating contour curves for 2D scalar fields in Julia
Other
44 stars 13 forks source link

Implement performance improvements using bit masking #50

Closed sjkelly closed 4 years ago

sjkelly commented 4 years ago

The chief suspect in allocation (and triggering GC) was all the small arrays allocated to handle ambiguous cases. With this solution we use the 5th bit (0x10) to indicate an ambiguous case. The logic to disambiguate is handled in the processing of crossings. This significantly reduces memory allocations and yields modest performance improvements.

This is a cleaned up version of #49 without the hashing hacks.

Memory: 2.22Mb -> 985Kb Allocations: 21,188 -> 1,189 Net performance gain: ~25%

sjkelly commented 4 years ago

@SimonDanisch @tomasaschan I have tested this with the MakieGallery regression suite and all looks good. I plan to merge later this week if there are no objections.