Skip to content

Optimize the performance of intrusive_heap - #1674

Merged
ericniebler merged 9 commits into
NVIDIA:mainfrom
TypeCombinator:main
Nov 11, 2025
Merged

ericniebler merged 9 commits into
NVIDIA:mainfrom
TypeCombinator:main

Conversation

@TypeCombinator

Copy link
Copy Markdown
Contributor

Recently, I refactored the intrusive heap. Conservatively speaking, after the refactoring, the performance of the intrusive heap on small datasets has nearly doubled, while on large datasets, it has improved by at least 20%, depending on the specific application scenario.

When inserting into or removing nodes from a binary heap, the parent pointers of nodes along the sift-up or sift-down path remain unchanged. By leveraging this fact, we can reduce the maintenance of parent pointers in the heap. Moreover, using double pointers greatly simplifies operations and eliminates many branches.

Undoubtedly, there are faster implementations available, such as the quad heap. However, without altering the original design, preserving compatibility, and after careful trade-offs, this is arguably the best implementation you will find.

@copy-pr-bot

copy-pr-bot Bot commented Nov 3, 2025

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@TypeCombinator TypeCombinator changed the title Optimizing the performance of intrusive heap Optimize the performance of intrusive heap Nov 3, 2025
@TypeCombinator

Copy link
Copy Markdown
Contributor Author

Ping...

@TypeCombinator TypeCombinator changed the title Optimize the performance of intrusive heap Optimize the performance of intrusive_heap Nov 6, 2025
@ericniebler

Copy link
Copy Markdown
Collaborator

/ok to test d19ebed

@ericniebler

Copy link
Copy Markdown
Collaborator

Ping...

sorry for the delay. last week was a c++ standardization meeting. i was maxed.

@TypeCombinator

Copy link
Copy Markdown
Contributor Author

Ping...

sorry for the delay. last week was a c++ standardization meeting. i was maxed.

No worries, and thanks for your reply! I was aware of the C++ meeting from my email with Maikel, so I totally understand and was happy to wait.

@ericniebler

Copy link
Copy Markdown
Collaborator

/ok to test f96b537

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants