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

Optimize query unpacking #27

Merged
merged 5 commits into from
Jan 29, 2024
Merged

Optimize query unpacking #27

merged 5 commits into from
Jan 29, 2024

Conversation

Ukendio
Copy link
Member

@Ukendio Ukendio commented Jan 22, 2024

This PR resolves #30 where it improves performance of queries by up to 35% by optimizing query unpacking. What we do is we inline the destructering of the column data with manual indexes up to query length 4 as that is when unpack starts to get even in speed. This saves a lot of computation in the grand scheme of things as the optimization takes place at expand function which is invoked at every iteration.

image

@jackTabsCode
Copy link
Contributor

jackTabsCode commented Jan 26, 2024

manual indexes up to query length 4 as that is when unpack starts to get even in speed

Could we get separate benchmarks for the variable amounts of paths to confirm this?

@LastTalon LastTalon changed the title Adds hotpathing Optimizes query unpacking Jan 26, 2024
@LastTalon LastTalon changed the title Optimizes query unpacking Optimize query unpacking Jan 26, 2024
@jackTabsCode jackTabsCode added the improvement An imperfection we can make better label Jan 27, 2024
@Ukendio
Copy link
Member Author

Ukendio commented Jan 27, 2024

After more thorough benchmarking it turns out that even beyond 8 manual indices it still outperforms unpack. However at 5+ the gain is less than 15% and stays around that making the optimization not that useful. I should say checking for multiple cases has downsides as well at about 2% for queries when not enabling hot paths.

we should therefore figure out the median query length and if it is above 4-5 then we should probably support that.
image

@LastTalon
Copy link
Member

Can we link this to an issue rather than labeling the PR directly? Issues are better for visibility when others come looking.

@Ukendio Ukendio merged commit 6cbbe93 into main Jan 29, 2024
6 checks passed
@Ukendio Ukendio deleted the adds-hotpathing branch January 29, 2024 08:39
@Ukendio Ukendio mentioned this pull request Jan 29, 2024
jackTabsCode pushed a commit that referenced this pull request Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement An imperfection we can make better
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Query unpacking is slow
3 participants