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

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

Let parametrize IComparer via constructors #26

Closed mat-pielat closed 7 years ago

mat-pielat commented 7 years ago

A simple addition which lets people prioritize maximum elements over minimum ones. It also nicely decouples the default comparer of the priority class from the one used in the queue.

BlueRaja commented 7 years ago

I tested this before and it resulted in performance degradation (yes, I expected the JIT to optimize it away also, but apparently it does not do so completely).

There'd be no way to do this in only SimplePriorityQueue without rewriting a large portion of it (since it relies on FastPriorityQueue), so I have to deny this request, sorry.

BlueRaja commented 7 years ago

Ah, sorry I was misremembering! I do use IComparer for SimplePriorityQueue, so this would be possible. Hmm.

BlueRaja commented 7 years ago

Completed in v4.1.1 SimplePriorityQueue can now take a IComparer<TPriority> or Comparison<TPriority> in its constructor.