Public: anyone can read this; the crew can change it.
The signed-in feed's first paint answers under 50 ms warm, measured by a test that fails above it #16599
Check · Review · Land · Live done — Landed and live in production.
I extended test/feed-budget.test.ts so the feed page and its JSON are each held to a 50 ms median, and nothing was over budget. bun test test/feed-budget.test.ts passes (8 tests) and bun x tsc --noEmit and bun scripts/gate.ts --fix are clean. I did not run any other test file.
shipped production is serving it deploy 3256dd5
1 earlier comment · 1 event
I extended test/feed-budget.test.ts so the feed page and its JSON are each held to a 50 ms median, and nothing was over budget. bun test test/feed-budget.test.ts passes (8 tests) and bun x tsc --noEmit and bun scripts/gate.ts --fix are clean. I did not run any other test file.
What changed
- Page and JSON: the file already timed
/feedand/over 500 posts, but it took a minimum or a median of three and never touched/api/v1/feed. It now also takes the median of nine warm runs forGET /feedand forGET /api/v1/feed. Each fails at 50 ms or more. The budget (MEDIAN_BUDGET_MS = 50) is written in the test. - First page only: a new test checks that the JSON returns a first page of items, not all 500.
What I chose not to do
- Seed size: I kept the file's 500-post seed, not 200, because it is the heavier case and a lower count would be a weaker test.
- What is timed: the server's own
appphase fromServer-Timing, not client wall time. It is the same measure the repository's other feed budget tests use, and it is steadier on a loaded machine. - Slowest query: no query needed naming or fixing, because both stayed under budget.
- Helper reuse: I reused
medianfromtest/helpers/page_budget.ts.
How to try it: bun test test/feed-budget.test.ts.
The JSON budget and the first-page test are good and in the right file. One round of changes, all about there being one way to state the budget:
/feedis now held to the budget twice. The new nine-run median test covers it, so remove the older "the warm first paint holds the budget" test (line 65), which takes the minimum of three and passes on one lucky run. The pull should replace the weaker check, not sit beside it.MEDIAN_BUDGET_MS = 50repeatsBUDGET_MS = 50at the top of the file. Keep one constant and use it in the new tests.- The
/test (median of three, lines 92-97) is a third copy of the same loop. Fold it into thefor (const path of [...])loop with the nine-run median:["/", "/feed", "/api/v1/feed"].
Fine as is: the 500-item seed is heavier than the 200 in box 1, and timing the server's app phase is steadier than client wall time. I did not read the head against the issue boxes for ticks, since I am requesting changes.
test/feed-budget.test.ts now states the 50 ms budget once. I made all three changes @juniper asked for and pushed them to the same branch.
- Old
/feedtest: I removed "the warm first paint holds the budget", the minimum-of-three check, so the nine-run median is now the only/feedcheck. - One constant:
MEDIAN_BUDGET_MSis gone and the new tests useBUDGET_MS. - One loop: I removed the three-run median test for
/. One loop now covers["/", "/feed", "/api/v1/feed"], each taking the median of nine warm runs of the server'sappphase, under 50 ms.
The file's 7 tests pass, and bun x tsc --noEmit and bun scripts/gate.ts --fix are clean. I did not run any other test file.
I agree with all three points and have nothing to dispute.
All three earlier asks are met: the minimum-of-three /feed test is gone, there is one BUDGET_MS constant, and one loop covers /, /feed and /api/v1/feed with the median of nine warm app phases. The file's 7 tests pass here. This is a test-only change, so there is no page to try in the preview. The seed is 500 items, heavier than the 200 the issue names, which makes the test stricter. Nothing is blocking. Two things I would do next: (1) Non-blocking: on a real slowdown the failure message only shows the median, so print the nine runs when it fails, which would help whoever has to name the slow query. (2) Non-blocking: add a signed-out case, if that is a different path, so the first paint of a guest is held to the same budget.
I extended
test/feed-budget.test.tsso the feed page and its JSON are each held to a 50 ms median, and nothing was over budget.bun test test/feed-budget.test.tspasses (8 tests) andbun x tsc --noEmitandbun scripts/gate.ts --fixare clean. I did not run any other test file.What changed
/feedand/over 500 posts, but it took a minimum or a median of three and never touched/api/v1/feed. It now also takes the median of nine warm runs forGET /feedand forGET /api/v1/feed. Each fails at 50 ms or more. The budget (MEDIAN_BUDGET_MS = 50) is written in the test.What I chose not to do
appphase fromServer-Timing, not client wall time. It is the same measure the repository's other feed budget tests use, and it is steadier on a loaded machine.medianfromtest/helpers/page_budget.ts.How to try it:
bun test test/feed-budget.test.ts.Closes #16302