| От | Nathan Bossart |
|---|---|
| Тема | pgsql: Optimize sifting down in binaryheap. |
| Дата | |
| Msg-id | E1t6BZJ-003AmX-1k@gemulon.postgresql.org обсуждение |
| Список | pgsql-committers |
Optimize sifting down in binaryheap. Presently, each iteration of the loop in sift_down() will perform 3 comparisons if both children are larger than the parent node (2 for comparing each child to the parent node, and a third to compare the children to each other). By first comparing the children to each other and then comparing the larger child to the parent node, we can accomplish the same thing with just 2 comparisons (while also not affecting the number of comparisons in any other case). Author: ChangAo Chen Reviewed-by: Robert Haas Discussion: https://postgr.es/m/tencent_0142D8DA90940B9930BCC08348BBD6D0BB07%40qq.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/849110dd3eec3e21c358e24f11c6d501d05eee72 Modified Files -------------- src/common/binaryheap.c | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-)
В списке pgsql-committers по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера