Hacker News new | past | comments | ask | show | jobs | submit login
You're doing server performance optimization wrong (2010) (acm.org)
3 points by vintermann on May 7, 2022 | hide | past | favorite | 1 comment



Summary: A common way to store a binary heap is so that the children of n are located at {2n, 2n+1}. This has the effect that parent and child are usually located in different memory pages if the tree is big. Traversing the tree is faster if it's stored so that each page contains a small subtree that is a few levels deep.

So we go from [1] to [2] where the white boxes are memory pages and the numbers are order of nodes in memory.

[1] https://dl.acm.org/cms/attachment/2c619117-0016-424e-9d6a-8e...

[2] https://dl.acm.org/cms/attachment/c57e84df-5cde-4e48-9a2d-d6...




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: