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

Further sectioned results performance improvements #6646

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

tgoyne
Copy link
Member

@tgoyne tgoyne commented May 17, 2023

(But actually just performance improvements to the underlying things since that's where all the time is spent).

This eliminates TableRef checks in a pile of places where it very definitely will always be valid, generally because we get to the place via a call on a Table. TableRef checking isn't very expensive, but it adds up to a few percent of the runtime.

Checking if a TableView is up to date previously involved memory allocations, and it's an operation we do a lot. It now reuses a buffer between calls. Frozen table views now skip the check entirely as they're always up to date if they've ever been evaluated.

Sorting a TableView handled detached ObjKeys which would result from "snapshot" tableviews that we didn't re-evaluate. We never actually sort those after the fact, so we can just skip that handling and save some time.

Looking up an ObjKey in a Table is actually a kinda slow operation and was a meaningful portion of the runtime of sorting TableViews. The newly introduced ClusterTree::LeafCache optimizes lookups where subsequent lookups are on the same leaf, which will be fairly often in cache_first_column() due to it reading matching rows in table order. It is performance-neutral for sparse queries which never have multiple rows on the same leaf.

@tgoyne tgoyne self-assigned this May 17, 2023
@cla-bot cla-bot bot added the cla: yes label May 17, 2023
This dramatically speeds up sorting TableViews with fairly dense sets of rows,
and is performance-neutral for sparse sets with at most one row per leaf used.
Passing the Results to the SDK rather than Mixed allows it to use `.get<Obj>()`
where applicable, which eliminates a redundant lookup by obj key when
sectioning a table.
This was never actually used (Results().snapshot().sort() produces a live
Results) and had a significant performance impact.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant