cemyuksel / cyCodeBase

An open source programming resource intended for graphics programmers.
MIT License
269 stars 60 forks source link

Weighted Sample Elimination uses cyHeap but PointCloud doesn't. #19

Open graphitemaster opened 2 years ago

graphitemaster commented 2 years ago

I find it a bit strange that there is an implementation of a generic heap data structure for the weighted sample elimination algorithm but the point cloud data structure used for nearest neighbor searches uses the standard C++ <algorithm> provided make_heap, push_heap, and pop_heap functions. It's especially strange (to me) since the commit that introduced the weighted sample elimination also introduced this max heap data structure. I assume the intent was to use it for both algorithms.

With some local testing here, converting the point cloud data structure to using cyHeap by creating a side-channel heap structure is slightly faster than using the standard C++ max heap algorithms in <algorithm>.

cemyuksel commented 2 years ago

I am surprised to hear this. The cy::Heap class was designed to allow random access and updates. I did not put much effort into optimizing it. I would expect the standard C++ max heap functions in <algorithm> to be better optimized.