Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Sources/HeapModule/Heap.swift
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ extension Heap {

guard newCount > origCount, newCount > 1 else {
// If we didn't append, or the result is too small to violate heapness,
// then we have nothing else to dp.
// then we have nothing else to do.
return
}

Expand All @@ -381,7 +381,7 @@ extension Heap {
//
// FIXME: Write a benchmark to verify this heuristic.
let heuristicLimit = 2 * newCount / newCount._binaryLogarithm()
let useFloyd = (newCount - origCount) < heuristicLimit
let useFloyd = (newCount - origCount) > heuristicLimit
_update { handle in
if useFloyd {
handle.heapify()
Expand Down
Loading