Skip to content

Commit af37fe5

Browse files
authored
Adds [Heap]PriorityQueue.of constructor. (#734)
Introduces efficient (linear-number of comparisons) "heapify" algorithm for converting an unsorted list to a heap-sorted list, using it for the of constructor, and after a large addAll operation, when it's presumed faster than just bubbling down all the new elements. Also rewrites HeapPriorityQueue to use a growable list as backing array, instead of implementing the same thing using the double-when-full algorithm, and still having to deal with nullable cells. The platform growable list implementation is assumed to efficiently avoid some of those null checks.
1 parent 635dfa3 commit af37fe5

File tree

3 files changed

+157
-111
lines changed

3 files changed

+157
-111
lines changed

pkgs/collection/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
`Map.entries`.
66
- Explicitly mark `BoolList` as `abstract interface`
77
- Address diagnostics from `strict_top_level_inference`.
8+
- Optimize equality and hash code for maps by using `update` and a `values`
9+
iterator to avoid extra lookups.
10+
- Add `PriorityQueue.of` constructor and optimize adding many elements.
11+
- Address diagnostics from `strict_top_level_inference`.
812

913
## 1.19.1
1014

0 commit comments

Comments
 (0)