BlueRaja / High-Speed-Priority-Queue-for-C-Sharp

A C# priority queue optimized for pathfinding applications
MIT License
1.16k stars 169 forks source link

Potential mis-behaviour #10

Closed tcassell closed 8 years ago

tcassell commented 8 years ago

Hey, I was just looking at your code here and noticed that you didn't check insertionIndex for wrap-around cases in the HasHigherPriority function. It's probably not noticeable, but if one PriorityQueue was used for a long time, it could potentially cause issues there. But then again, it is kind of a rare case, so I don't know if it's worth it to do the proper checks every time.

Just thought I'd let you know.

BlueRaja commented 8 years ago

The insertionIndex is a 64-bit long. If you inserted 1 million nodes a second, it would take 290,000 years to wrap around. It's not something I'm concerned about.