mirror of
https://github.com/git/git
synced 2024-10-30 14:03:28 +00:00
c18eecbe5c
The speed of the merged_iter_pqueue_add() can be improved by using a pointer to the pq_entry struct, which is 96 bytes. Since the pq_entry param is worked directly on the stack and does not currently have a pointer to it, the merged_iter_pqueue_add() function is slightly slower. References to pq_entry in reftable have typically included pointers, such as both of the params for pq_less(). Since we are working with pointers in the pq_entry param, as keenly pointed out, the pq_entry param has also been made into a const since the contents of the pq_entry param are copied and not manipulated. Signed-off-by: Elijah Conners <business@elijahpepe.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
33 lines
864 B
C
33 lines
864 B
C
/*
|
|
Copyright 2020 Google LLC
|
|
|
|
Use of this source code is governed by a BSD-style
|
|
license that can be found in the LICENSE file or at
|
|
https://developers.google.com/open-source/licenses/bsd
|
|
*/
|
|
|
|
#ifndef PQ_H
|
|
#define PQ_H
|
|
|
|
#include "record.h"
|
|
|
|
struct pq_entry {
|
|
int index;
|
|
struct reftable_record rec;
|
|
};
|
|
|
|
struct merged_iter_pqueue {
|
|
struct pq_entry *heap;
|
|
size_t len;
|
|
size_t cap;
|
|
};
|
|
|
|
struct pq_entry merged_iter_pqueue_top(struct merged_iter_pqueue pq);
|
|
int merged_iter_pqueue_is_empty(struct merged_iter_pqueue pq);
|
|
void merged_iter_pqueue_check(struct merged_iter_pqueue pq);
|
|
struct pq_entry merged_iter_pqueue_remove(struct merged_iter_pqueue *pq);
|
|
void merged_iter_pqueue_add(struct merged_iter_pqueue *pq, const struct pq_entry *e);
|
|
void merged_iter_pqueue_release(struct merged_iter_pqueue *pq);
|
|
int pq_less(struct pq_entry *a, struct pq_entry *b);
|
|
|
|
#endif
|