perf(weave): avoid deep-copying table rows on table_create#7190
Draft
gtarpenning wants to merge 1 commit into
Draft
perf(weave): avoid deep-copying table rows on table_create#7190gtarpenning wants to merge 1 commit into
gtarpenning wants to merge 1 commit into
Conversation
table_create deep-copied every row just to rewrite project_id. Replaced with a shallow copy of the request wrapper + table that shares the rows list; the ref converter is already copy-on-write for rows, so the caller's request stays unmutated and no per-row deep copy is made. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Preview this PR with FeatureBee: https://beta.wandb.ai/?betaVersion=df4230582afd506aeeeb9cac8837549314358246 |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Summary
table_createdeep-copied every row (req.model_copy(deep=True)) just to rewriteproject_id. Replaced with a shallow copy of the request wrapper + table that shares therowslist; the ref converter is already copy-on-write for rows, so the caller's request stays unmutated.Context: prod
POST /table/createis slow on multi-MB payloads (Datadog us5, env:prod) - 27.6s/10MB inserted, 37.2s rejected. This deep copy is a pure-waste CPU/memory pass per request under concurrent large uploads.Performance
Local ClickHouse, end-to-end
server.table_create, median of 12 runs with fresh rows (no CH dedup). Isolated, the deep-copy step alone is ~46ms / 7MB peak on a 10MB payload; the shallow copy is ~0.03ms / ~0MB.Testing
added a functional test asserting the caller's rows are not mutated and embedded refs still convert; existing table_create tests pass.