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

People, the Closed list and Activity answer in under 50 ms with 200 deals, and the speed test proves it #228

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

People, the Closed list and Activity are now in the speed test's routes list, each held to 50 ms with 200 deals, both warm and right after an edit. The speed test and the people tests pass and tsc is clean. I ran no other test files and did not run bun scripts/gate.ts, because there is no scripts/ gate in this clone.

Notes

shipped production is serving it deploy d2eada7

opened this

People, the Closed list and Activity are now in the speed test's routes list, each held to 50 ms with 200 deals, both warm and right after an edit. The speed test and the people tests pass and tsc is clean. I ran no other test files and did not run bun scripts/gate.ts, because there is no scripts/ gate in this clone. The full bun test was not run; the forge runs it on the push.

Test changes (src/speed.test.ts)

  • /people and /activity are added as routes. Activity is requested with an admin identity, since reading the audit log needs admin.
  • The Closed list is not its own route. It is the lower section of the clock, shown with ?closed=1, so the route entry is /?closed=1.
  • Fixture rows: every fifth deal past the first five has its closing marked done. About a third have a sent reminder to the lender plus a matching reminder.send audit row, so People and Activity have real rows to render.
  • Existing cases still pass.

One fix (src/people.ts, no migration, no schema change)

  • Cause: people() rescanned every key in its map on each merge, even when the row being merged had no keys in the map yet. The fixture has every lender sharing one email, so this ran 200 times.
  • Effect: the people() call itself dropped from about 10–23 ms to about 3–6 ms. The listDeals read in front of it is the same one the clock uses (about 12 ms). People at 200 deals was 36 ms warm and 43 ms cold before this change; I did not re-measure the page after it.
  • Behaviour: the rescan now runs only when the row already has keys. The people tests pass unchanged.

Not done

  • No migration or index. Activity measured about 17 ms warm and 21 ms cold (the cold run was a single sample), so it needed none.
  • No contract cell changed.

Flake: the clock's cold-after-edit case once read 54 ms in 1 of about 6 full-file runs and passed on every other run. The clock's cold time is around 35 ms, so the margin is thin on a busy machine.

To try

  • bun test src/speed.test.ts

🤖 Generated with Claude Code

Closes #224

commented

People, the Closed list and Activity are now in the speed test's routes list, each held to 50 ms with 200 deals, both warm and right after an edit. The speed test and the people tests pass and tsc is clean. I ran no other test files and did not run bun scripts/gate.ts, because there is no scripts/ gate in this clone. The full bun test was not run; the forge runs it on the push.

Test changes (src/speed.test.ts)

  • /people and /activity are added as routes. Activity is requested with an admin identity, since reading the audit log needs admin.
  • The Closed list is not its own route. It is the lower section of the clock, shown with ?closed=1, so the route entry is /?closed=1.
  • Fixture rows: every fifth deal past the first five has its closing marked done. About a third have a sent reminder to the lender plus a matching reminder.send audit row, so People and Activity have real rows to render.
  • Existing cases still pass.

One fix (src/people.ts, no migration, no schema change)

  • Cause: people() rescanned every key in its map on each merge, even when the row being merged had no keys in the map yet. The fixture has every lender sharing one email, so this ran 200 times.
  • Effect: the people() call itself dropped from about 10–23 ms to about 3–6 ms. The listDeals read in front of it is the same one the clock uses (about 12 ms). People at 200 deals was 36 ms warm and 43 ms cold before this change; I did not re-measure the page after it.
  • Behaviour: the rescan now runs only when the row already has keys. The people tests pass unchanged.

Not done

  • No migration or index. Activity measured about 17 ms warm and 21 ms cold (the cold run was a single sample), so it needed none.
  • No contract cell changed.

Flake: the clock's cold-after-edit case once read 54 ms in 1 of about 6 full-file runs and passed on every other run. The clock's cold time is around 35 ms, so the margin is thin on a busy machine.

To try

  • bun test src/speed.test.ts

🤖 Generated with Claude Code

Approved

Routes for people, the clock with closed deals (the Closed list is the lower section of the clock; there is no /closed route) and admin activity are held to the budget; fixture gains closed deals, sent reminders and audit rows; the people() rescan fix is behaviour-preserving (a fresh row holds no keys). No contract cell touched. Note for later: the pull gives no after-time for the People page itself, and the clock cold case is flaky near the budget.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs