Skip to content

ASH-214: ledger perf — synchronous=NORMAL + skip redundant tokenization#16

Merged
cstaszak merged 1 commit into
mainfrom
cstaszak/ash-214-ledger-perf
May 22, 2026
Merged

ASH-214: ledger perf — synchronous=NORMAL + skip redundant tokenization#16
cstaszak merged 1 commit into
mainfrom
cstaszak/ash-214-ledger-perf

Conversation

@cstaszak

Copy link
Copy Markdown
Contributor

The two low-risk, unambiguous wins from the ASH-214 ledger-hot-path cluster. The headline restructure (#1) is intentionally not here.

  • synchronous=NORMAL on the ledger's write-mode DSN. Under WAL this is crash-safe (no corruption ever; at most the last transaction is lost on an OS/power crash) and skips an fsync per commit. It is already what internal/lsp/cache uses — and that package's comment already (incorrectly) claimed the ledger matched it.
  • Skip the tokens_out_no_prefix re-tokenization when no jail prefixes are configured (the default). StripPrefixes is a no-op then, so the value equals tokens_out — no need to tokenize the full response a third time per call.

Deliberately not in this PR

ASH-214 stays open for that measured work.

🤖 Generated with Claude Code

The two low-risk wins from the ledger-hot-path cluster. The headline
restructure (writing the response frame before the ledger row) is left
for separate measured work — it trades away the deliberately-preserved
LedgerError-in-response behavior and needs a microbenchmark first.

- internal/ledger: add `synchronous=NORMAL` to the write-mode DSN.
  Under WAL this is crash-safe (no corruption; at most the last
  transaction is lost on an OS/power crash) and skips an fsync per
  commit. It is already what internal/lsp/cache uses — and that
  package's comment already (incorrectly) claimed the ledger matched.
- cmd/ashd: tokens_out_no_prefix re-tokenized the full response a
  third time per call purely to measure the path-prefix tax. With no
  jail prefixes configured (the default), StripPrefixes is a no-op and
  the value equals tokens_out — so skip the second tokenization
  entirely in that case.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@cstaszak
cstaszak merged commit 204ece3 into main May 22, 2026
5 checks passed
@cstaszak
cstaszak deleted the cstaszak/ash-214-ledger-perf branch May 22, 2026 01:00
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