Repository navigation
perf(compile): batch analysis preparation normalization - #957
Merged
Merged
Conversation
Analysis preparation normalized each model's stubbed SQL with its own native call, releasing and reacquiring the GIL once per model. Under the analysis worker threads most of that time was spent waiting to reacquire the GIL rather than normalizing. Normalize every batch member in one detached native call instead. A compile catalog runs the batch in parallel on its analysis pool while no analysis batch occupies the pool, and in turn otherwise, so preparing the next ready batch never queues behind a running one. Each member keeps its own result or error in place, so the same first error is raised at the same point as before, and prepared payloads, cache keys, and cache hits are unchanged.
Normalize each preparation batch in chunks of 256 members so one native call never holds copies of a whole dense batch at once. This keeps warm compile peak memory at its previous level while preserving the single GIL release per chunk.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Analysis preparation called native SQL normalisation once per model or shared binding query from Python. Most of that time was threads waiting to reacquire the GIL after each short call: about 1.6 s at dense 3k and 5.4 s at dense 10k cold (CHI-509).
Changes
Verification
make test,make check-ci.