Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: optimize tree node insertion #3105

Merged
merged 1 commit into from
Mar 20, 2024
Merged

Conversation

kolesnikovae
Copy link
Collaborator

This is a pretty obvious optimization that we should have implemented much earlier. This function may contribute up to 25% of the total query CPU time in rare cases. The larger the tree, the more significant the benefit.

image

@kolesnikovae kolesnikovae marked this pull request as ready for review March 15, 2024 10:02
@kolesnikovae kolesnikovae requested a review from a team as a code owner March 15, 2024 10:02
Copy link
Contributor

@aleks-p aleks-p left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good find! Out of curiosity, what prevents inlining to happen here at compile time? Would using PGO have made a difference?

@kolesnikovae kolesnikovae merged commit 316013f into main Mar 20, 2024
16 checks passed
@kolesnikovae kolesnikovae deleted the perf/optimize-tree-insert branch March 20, 2024 09:57
@kolesnikovae
Copy link
Collaborator Author

kolesnikovae commented Mar 20, 2024

I haven't looked too deep into the inlining budget, but AFAIK Go never inlines functions that use range. Plus the sort.Search function argument – I'm not sure if this is possible to inline it at all

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.

None yet

2 participants