Closed maciejtrybilo closed 9 months ago
In the current implementation the copy-on-write causes excessive copying when building the box tree.
I've inlined the merge function into transformToBoxTree and used a storage variable to avoid it being passed around and copied.
merge
transformToBoxTree
storage
In my tests this results in a ~30x speedup and makes all the difference in my use case.
Also IMO the code is a little clearer now as it shows the recursive nature of the algorithm in one function.
In the current implementation the copy-on-write causes excessive copying when building the box tree.
I've inlined the
merge
function intotransformToBoxTree
and used astorage
variable to avoid it being passed around and copied.In my tests this results in a ~30x speedup and makes all the difference in my use case.
Also IMO the code is a little clearer now as it shows the recursive nature of the algorithm in one function.