Merge branch 'kk/prio-queue-get-put-fusion' into seen

The lazy priority queue optimization pattern (deferring actual removal
in prio_queue_get() to allow get+put fusion) has been folded directly
into prio_queue itself, speeding up commit traversal workflows and
simplifying callers.

* kk/prio-queue-get-put-fusion:
  prio-queue: fold lazy_queue into prio_queue for automatic get+put fusion
  prio-queue: rename .nr to .nr_ and add accessor helpers
This commit is contained in:
Junio C Hamano
2026-06-18 13:39:45 -07:00
16 changed files with 131 additions and 191 deletions
+2 -9
View File
@@ -782,24 +782,17 @@ void commit_list_sort_by_date(struct commit_list **list)
struct commit *pop_most_recent_commit(struct prio_queue *queue,
unsigned int mark)
{
struct commit *ret = prio_queue_peek(queue);
int get_pending = 1;
struct commit *ret = prio_queue_get(queue);
struct commit_list *parents = ret->parents;
while (parents) {
struct commit *commit = parents->item;
if (!repo_parse_commit(the_repository, commit) && !(commit->object.flags & mark)) {
commit->object.flags |= mark;
if (get_pending)
prio_queue_replace(queue, commit);
else
prio_queue_put(queue, commit);
get_pending = 0;
prio_queue_put(queue, commit);
}
parents = parents->next;
}
if (get_pending)
prio_queue_get(queue);
return ret;
}