Skip to content

Benchmark ID refetching versus direct batch patches - #23

Open
ianmacartney wants to merge 5 commits into
ian/find-snapshot-guaranteesfrom
ian/benchmark-batch-refetching
Open

ianmacartney wants to merge 5 commits into
ian/find-snapshot-guaranteesfrom
ian/benchmark-batch-refetching

Conversation

@ianmacartney

@ianmacartney ianmacartney commented Sep 18, 2026 •

Copy link
Copy Markdown
Member

Measures the effect of re-fetching batch candidates before patching, building on the snapshot-consistency guidance and example fixes in #22.

The current benchmark compares three variants together: { id, value } followed by parallel direct patches; IDs followed by parallel per-row get/check/patch; and the same { id, value } query results and mutation arguments as direct patch, followed by the shared re-fetch logic. No variant passes full documents or artificial padding. The third variant controls for the different payloads in the earlier comparison.

In the latest 900-execution run, re-fetching with identical payloads still reduced mean query-plus-mutation server time by about 61% for 25-row batches and 64–71% for 100-row batches. All four paired intervals exclude zero. Comparing values against IDs with the same re-fetch logic was inconclusive: every paired 95% interval included zero. The payload difference does not explain the large speedup in this workload; the backend cause remains unidentified.

The harness uses isolated fixtures, 50 matched trials per case, five warmup trials, all six variant orders, server completion logs, result verification, and cleanup. Re-fetching adds one reported document read per row (3 versus 2 across the complete transaction), with identical writes. All functions are internal. BENCHMARK.md records full results, paired intervals, methodology, and the earlier two-variant runs.

Validation:

  • npm run build, npm run typecheck, npm run lint, and all 57 tests passed.
  • Deployed and benchmarked on dev enchanted-cardinal-63; all 900 measured executions produced the expected result, with no reported OCC retries or execution errors.
  • Database usage matched the previous run, including the new control. Fixtures were removed and the table was confirmed empty.

@ianmacartney ianmacartney changed the title perf: benchmark batch row refetching before patching Benchmark ID refetching versus direct batch patches Sep 18, 2026

Copy link
Copy Markdown
Member Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@pkg-pr-new

pkg-pr-new Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@convex-dev/batch-worker@23

commit: c56ad68

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1 issue found across 7 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="BENCHMARK.md">

<violation number="1" location="BENCHMARK.md:57">
P2: The report claims raw evidence is available at `.context/benchmark-results/`, but those files are not included in the repository, so readers cannot audit the published measurements or the stated run ID. Commit the referenced artifacts or state explicitly that they are unavailable and provide an accessible archive/link.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread BENCHMARK.md Outdated
Comment on lines +57 to +58
Run ID: `478bc6c6-a4f9-40f6-bd71-1f6c15fead8e`. Raw evidence is in
`.context/benchmark-results/results.json`, `cases.json`, and `logs.jsonl`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: The report claims raw evidence is available at .context/benchmark-results/, but those files are not included in the repository, so readers cannot audit the published measurements or the stated run ID. Commit the referenced artifacts or state explicitly that they are unavailable and provide an accessible archive/link.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At BENCHMARK.md, line 57:

<comment>The report claims raw evidence is available at `.context/benchmark-results/`, but those files are not included in the repository, so readers cannot audit the published measurements or the stated run ID. Commit the referenced artifacts or state explicitly that they are unavailable and provide an accessible archive/link.</comment>

<file context>
@@ -0,0 +1,99 @@
+resource-usage measurement, not a claim of a 50% increase in total cost or
+latency. Byte counts include stored row fields and metadata, not just padding.
+
+Run ID: `478bc6c6-a4f9-40f6-bd71-1f6c15fead8e`. Raw evidence is in
+`.context/benchmark-results/results.json`, `cases.json`, and `logs.jsonl`.
+
</file context>
Suggested change
Run ID: `478bc6c6-a4f9-40f6-bd71-1f6c15fead8e`. Raw evidence is in
`.context/benchmark-results/results.json`, `cases.json`, and `logs.jsonl`.
Run ID: `478bc6c6-a4f9-40f6-bd71-1f6c15fead8e`. Raw evidence is generated by the reproduction command and is not included in this checkout.

@ianmacartney
ianmacartney force-pushed the ian/benchmark-batch-refetching branch from 97ab116 to 93b2ab5 Compare September 18, 2026 07:22
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.

1 participant