diff options
author | Junio C Hamano <gitster@pobox.com> | 2024-02-27 03:10:24 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-02-27 03:10:24 +0100 |
commit | 9f67cbd0a7725857d219da6720fc9a5acfda2960 (patch) | |
tree | f7566b4db8e2f5d362d3464965e4a324d8d8516f /reftable/pq.c | |
parent | Merge branch 'rs/use-xstrncmpz' (diff) | |
parent | reftable/reader: add comments to `table_iter_next()` (diff) | |
download | git-9f67cbd0a7725857d219da6720fc9a5acfda2960.tar.xz git-9f67cbd0a7725857d219da6720fc9a5acfda2960.zip |
Merge branch 'ps/reftable-iteration-perf'
The code to iterate over refs with the reftable backend has seen
some optimization.
* ps/reftable-iteration-perf:
reftable/reader: add comments to `table_iter_next()`
reftable/record: don't try to reallocate ref record name
reftable/block: swap buffers instead of copying
reftable/pq: allocation-less comparison of entry keys
reftable/merged: skip comparison for records of the same subiter
reftable/merged: allocation-less dropping of shadowed records
reftable/record: introduce function to compare records by key
Diffstat (limited to 'reftable/pq.c')
-rw-r--r-- | reftable/pq.c | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/reftable/pq.c b/reftable/pq.c index 2461daf5ff..e0ccce2b97 100644 --- a/reftable/pq.c +++ b/reftable/pq.c @@ -14,20 +14,9 @@ https://developers.google.com/open-source/licenses/bsd int pq_less(struct pq_entry *a, struct pq_entry *b) { - struct strbuf ak = STRBUF_INIT; - struct strbuf bk = STRBUF_INIT; - int cmp = 0; - reftable_record_key(&a->rec, &ak); - reftable_record_key(&b->rec, &bk); - - cmp = strbuf_cmp(&ak, &bk); - - strbuf_release(&ak); - strbuf_release(&bk); - + int cmp = reftable_record_cmp(&a->rec, &b->rec); if (cmp == 0) return a->index > b->index; - return cmp < 0; } |