Repository navigation
Work around slow PriorityQueue.remove - #2092
Conversation
| } | ||
| } | ||
|
|
||
| private IntHashSet queueDeleted = new IntHashSet(); |
| queueByZ.poll(); | ||
| if (queueByZ.peek() == null) | ||
| return true; | ||
| return getExploreValue(queueByZ.peek()) >= limit; |
There was a problem hiding this comment.
while (!queueByZ.isEmpty()) {
IsoLabel head = queueByZ.poll();
if (!head.deleted) {
return getExploreValue(head) >= limit;
}
}
return true;Depending on the size of the underlying array it would probably be faster to sort it once and iterate over the array.
There was a problem hiding this comment.
The Java PriorityQueue is an extreme fast implementation (also backed on an array) and so it is incredible hard to beat it even if alternatives are theoretically faster.
There was a problem hiding this comment.
It would also allow to use a more finegrained Comparator and sort by deleted+z
karussell
left a comment
There was a problem hiding this comment.
Nice idea and works for me!
I'm just in the process to create a PR which adds isochrone to the measurement and would like to merge it before this PR so we should be able to see the differences better.
| queueByZ.poll(); | ||
| if (queueByZ.peek() == null) | ||
| return true; | ||
| return getExploreValue(queueByZ.peek()) >= limit; |
There was a problem hiding this comment.
The Java PriorityQueue is an extreme fast implementation (also backed on an array) and so it is incredible hard to beat it even if alternatives are theoretically faster.
See #2086.