You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This optimization is targeting cases when a SplPriorityQueue instance is used
exclusively with double or long priorities.
During the first insertion into an empty queue, the comparator is changed to
the specialized one if the priority of inserted inserted key is long or double.
During insertion to non-empty queue, comparator is swapped back to the generic
one on type conflict.
As a result code like following, where the weight field is always double or
int, runs almost twice as fast.
foreach ($items as $item) {
$pqueue->insert($item, -$item->weight);
if ($pqueue->count() > $size) {
$pqueue->extract();
}
}
0 commit comments