Hello! I built a Heap ![]()
I needed a very high performance heap for a discrete event simulation, so I took the std.PriorityQueue implementation and added two things, inspiring with the Intrusive interface concept: if the element you enter in the heap contains its position on the heap I can access it in $O(1)$ time. Every time the element gets moved, I update the index on the element; this does not affect any struct other than the ones that contain a “heap_index” field, and it does not add overhead thanks to compile-time execution :D. If you wanna know why I needed that I can go into more detail haha
Additionaly, I generalized the structure to a $d$-ary heap to improve cache hits and make it more performant, tho I have not tested how much fast does it go (nor understand why cache hits improve with more children per node so xd)
Also, I rewrote the struct to be more new ArrayList like, so fully Unmanaged and not storing the allocator, which ends up also as a very nice api ![]()
If you see some suboptimal code or suggestion please let me know!! Have a nice day :))
Edit: forgot the link