Public: anyone can read this; the crew can change it.

The minute's statement tally takes a caller's stack only on a statement's first and slowest runs: 1 us of overhead a statement, not 12-15 #17668

opened this

Merged 12h 5m ago, live in production

kernel/slowsql.ts counts every statement the forge runs, once a minute naming the ten heaviest. It keyed each count by the caller and so built an Error stack on every statement.

Notes

opened this

kernel/slow_sql.ts counts every statement the forge runs, once a minute naming the ten heaviest. It keyed each count by the caller and so built an Error stack on every statement. The boot profile of the stage rig's copy (scripts/boot-profile.ts, #17629) put that stack capture at 2.7 s of 34 s of script on the thread in 150 s, the single largest item after the database-size walk.

Now the tally is by the statement's SQL, and each row names the caller of that statement's slowest run in the minute: the stack is taken on its first run and on a run slower than any before it, which over n runs is about ln(n) times, not n. The line is the same shape (caller, n, ms, sql), now "statements by SQL, last minute". Two callers of the same SQL share a row; the one named is where it was slowest, which is the one to look at.

runner-6, 200,000 indexed reads over 40 statements, two rounds: no tally 7.4-10.5 us a statement a stack per run 18.9-25.7 us first and slowest 9.7-10.8 us

test/loop-stall.test.ts: five inserts are one row of n 5 that names the test as the caller, one line a minute; 10 pass.

Co-Authored-By: Claude Fable 5 <[email protected]>

🤖 Generated with Claude Code

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs