Repository navigation
Description
What happened?
On a project board with 2,000 tasks, the board's cap, the tab blocks for 16–26 s when the board is searched, left, opened or loaded. Each time the cost is one long main-thread task, and the page takes no input until it ends. At 50 tasks the same flows take 0.2–1 s.
The measurements are medians on a local production build, with min–max in brackets. "Visible" is the frame that shows the result. Search times start at the last key and include the 300 ms debounce.
| 2,000-task board | main 05543548e (2 Oct) |
main d6dd53ae0 (1 Oct) |
Longest task (2 Oct) |
|---|---|---|---|
Search zebra, narrowing 2,000 cards to 20 |
20.0 s (15.6–22.0), n=6 | 24.2 s (20.9–27.3), n=5 | 19.7 s |
| …the first search after the board loaded | — | 48.1 s, n=1 | — |
| Leave the board (click General) | 16.7 s (15.8–18.4), n=4 | 26.8 s (19.2–38.9), n=6 | 16.7 s |
| Clear the search (back to 2,000 cards) | 18.1 s (17.5–18.5), n=6 | 20.2 s (19.3–22.9), n=5 | 16.2 s |
| Open the board in-app (click the project's Tasks tab) | 22.0 s (21.7–22.8), n=4 | 26.4 s (23.8–32.3), n=6 | 21.9 s |
| Cold load of the board URL | 25.6 s (24.6–26.9), n=4 | 25.5 s (24.3–28.2), n=5 | 14.4 s |
The 1 Oct campaign also measured smaller boards (main d6dd53ae0, n=10 each):
| Board | Open in-app | Leave | Search | Clear | Cold load | JS heap after load | Elements | react-query observers |
|---|---|---|---|---|---|---|---|---|
| 50 tasks | 0.87 s | 0.23 s | 0.37 s | 0.82 s | 4.1 s | 83 MB | 8,276 | 2,525 |
| 350 tasks | 3.9 s | 0.73 s | 0.81 s | 3.4 s | 8.3 s | 236 MB | 15,583 | 16,625 |
| 2,000 tasks | 26.4 s | 26.8 s | 24.2 s | 20.2 s | 25.5 s | 1,059 MB | 54,992 | 94,175 |
Memory is part of it too. A reload of the 2,000-task board kept the old document's heap next to the new one, at 1.76 GB of JS heap. A few search narrow/clear cycles did the same. Twice the measurement renderer passed 3.5 GiB of the sandbox's 4 GiB, and the harness's guard killed it. Later runs collect garbage between samples.
There are two causes.
1. Unmounting cards costs time quadratic in the number of cards (search, leave, filter).
- react-query's
Query.removeObserverscans its observer array and copies it, throughincludesand thenfilter(@tanstack/query-core5.97.0,build/modern/query.js:148–150). Removing one observer is O(observers). - Every card holds about 47 observers. 30 of them sit on two queries that every card shares:
['backend','me','account','current-user']and['auth','session']. - They come from
useBackendQuery(services/platform/app/hooks/use-backend-query.ts), which callsuseSessionUser(), twouseQuerys, on every read. An adapted read never uses that answer:isAuthenticatedonly gates the branch for a name with no adapter row, andmissing-row.tssays every shipped read has one. - At 2,000 cards, those two queries hold 30,055 and 30,054 observers. Narrowing to 20 cards removes about 59,000 of them, each from an array of up to 30,000.
- In a CPU profile of that narrow,
removeObserverand itsfiltercallback take 32.5 s of 38.1 s busy (85%). React's own unmount takes 2.3 s.
2. Mounting a card costs about 10–13 ms of main thread on this host (open, clear, load).
Nothing is windowed: all 2,000 cards render, though about 40 fit a 1440×900 window. The self time of a cold 2,000-task load breaks down as:
| Category | Share of self time |
|---|---|
| i18n | 19.7% |
| React render/commit | 18.9% |
| GC | 17% |
| react-query | 10.4% |
@tale/ui |
5.5% |
| Radix | 4.5% |
| App data hooks | 3.8% |
| dayjs timezone | 1.4% |
What a card mounts:
- Two actor directories.
TaskCardcallsuseActorDirectory, andAssigneePickercallsuseAssignableActors. Each brings the member list, member context, project agents and automation listings, and builds its maps for that card. - Three automation listings, counting
TaskAutomationBadge. - About 20
useTranslationinstances. react-i18next 17.0.2 copies the i18n instance's own property descriptors into a wrapper for every hook instance (useTranslation.js:105, 1.9 s of self time in the load). i18next 26.0.4 re-derives the fallback codes and the language hierarchy on everyt()call. - The assignee picker's full
SearchableSelectoptions, built whether or not the picker opens.AssigneePickeralone is 5.9 s of 32.6 s busy in that profile, inclusive.
The board's read is not the bottleneck. It answers in about 0.26 s with 3.35 MB of JSON, every task's full description included, though no card shows one.
An experiment, not a proposed patch. I dropped the useSessionUser() call from useBackendQuery:
- const { isAuthenticated } = useSessionUser();
- // `requireAuth` is our own gate, not a react-query option — peel it off.
- const { requireAuth = true, ...queryOpts } = options ?? {};
+ const { requireAuth: _requireAuth, ...queryOpts } = options ?? {};
…
- enabled =
- !skipped &&
- (requireAuth ? isAuthenticated : true) &&
- (base.enabled ?? true);
+ enabled = !skipped && (base.enabled ?? true);I measured it ABBA (main, patch, patch, main) against the same main, on the same stack, fixture and harness. The table gives medians with min–max:
| 2,000-task board | 2 Oct: main 05543548e |
2 Oct: + experiment | 1 Oct: main d6dd53ae0 |
1 Oct: + experiment |
|---|---|---|---|---|
| Search narrow | 20.0 s (15.6–22.0) | 2.45 s (2.31–2.72) | 24.2 s (20.9–27.3) | 2.59 s (2.37–2.92) |
| Leave | 16.7 s (15.8–18.4) | 2.43 s (2.04–2.73) | 26.8 s (19.2–38.9) | 2.63 s (2.13–2.96) |
| Clear search | 18.1 s (17.5–18.5) | 16.5 s (16.0–18.2) | 20.2 s (19.3–22.9) | 16.8 s (16.4–17.9) |
| Open in-app | 22.0 s (21.7–22.8) | 16.7 s (16.5–17.0) | 26.4 s (23.8–32.3) | 18.8 s (17.9–21.7) |
| Cold load | 25.6 s (24.6–26.9) | 23.1 s (22.0–24.1) | — | — |
| JS heap after cold load | 1,060 MB | 847 MB | — | — |
| react-query observers | 94,175 | 34,091 | 94,175 | 34,091 |
Sample counts: on 2 Oct, n=6 for search and n=4 for the rest. On 1 Oct, n=6 except main's search (n=5).
At 50 tasks, on 2 Oct (n=8), the experiment did not slow anything: in-app open went from 1.01 s to 0.94 s, and leave from 0.25 s to 0.21 s.
So the experiment fixes cause 1 alone. Open, clear and load stay at 16–23 s, because they come from cause 2.
The experiment also drops the auth gate from the missing-row branch, which use-backend-query.test.ts covers in "gates on auth by default" and "requireAuth:false runs even when unauthenticated". A real fix keeps that gate without one session subscription per read, or retires it on purpose, tests included. As built, the experiment adds one tiny preloaded chunk, use-session-user: Cold-load JS goes from 44 modules and 2,059 KB gzip to 45 modules and 2,060 KB.
Steps to reproduce
- Build and serve production:
bun run buildinservices/platform, thenvite preview, proxying to the backend (ROLE=api,NODE_ENV=production) on a fresh Postgres. - Seed one project with 2,000 tasks. The replay kit's
seed-tasks.tsdoes it through the board's owncreateTask,addTaskCommentandaddTaskDependency, with a fixed seed. It gives a status mix and priorities p0–p3, 0–3 labels, five member assignees, descriptions on 70% of tasks, due dates on 30%, ~6% subtasks, comments and blockers. "zebra" is in 20 titles. - Open the project's General tab and click Tasks. The board blocks for ~22 s.
- Type
zebrain Search tasks. ~20 s pass before the 20 matches show. - Clear the search, ~18 s, or click General, ~17 s.
The replay kit is attached to the TALE-361 occurrence receipt (task box): stack scripts, the fixture seeder, the Playwright harness, raw JSONL samples, CPU profiles with a sourcemap-resolving analyzer, per-second host monitors and the experiment's diff.
Expected behavior
The board stays usable at its own cap. Acceptance budget, on this harness and host class (n ≥ 5, medians, the visible frame):
- Search narrowing and leaving the 2,000-task board: ≤ 3 s each, from the last key or the click. The experiment alone reaches ~2.5 s.
- Clearing the search, opening the board in-app, and a cold load at 2,000 tasks: ≤ 10 s each, with JS heap after load ≤ 600 MB. Today they take 18–26 s and the heap is ~1.06 GB. This needs cause 2 work, not only the experiment.
- No regression at 50 tasks: in-app open ≤ 1.1 s median (today 1.01 s), and
TASK-P1holds. - A guard in the tests: the observer count on the shared session queries stays flat as the board grows, for example a
tasks-workspacerender test with N cards that readsgetObserversCount(). - Kept intact: drag and drop, keyboard reach and screen-reader announcements of every card, the inline pickers, and the board's filters and counts.
Directions, largest first. These are candidates, not decisions:
- Stop subscribing every adapted read to the session probe. That is 64% of the board's observers, and cause 1's multiplier.
- Read the org-wide data once per board: actor directory, automation listings, member context, project, accessible users, standard agent. Hand it to the cards through the existing
TaskBoardProvider, and build each picker's options only when it opens. - Make a card's i18n cheaper: one
tper namespace from context, or labels computed once per board. - Window the columns. This is a design decision: dnd-kit, keyboard reach and screen-reader counts, and find-in-page all depend on it.
- Upstream: react-query keeps observers in an array, so each removal is O(n). A
Setwould make it O(1).
This is related to #3974, the dialog open and close on the same board, but is not a duplicate. #3974's item 2, the observer bookkeeping with 26,058 observers on current-user, is the same multiplier, so cause 1's fix should shrink its close too. This issue's flows are load, search, filter and leave. Recheck #3974's numbers after a fix.
Affected service
Platform (web app)
Version or commit
05543548eb486321e0cd6bdb82ccf98260cf5295 (2 Oct) and d6dd53ae0b9bd154f85d2f325ffadc3b56b46883 (1 Oct). Neither commit changes use-backend-query.ts, use-session-user.ts, the tasks feature or packages/ui/src/i18n relative to the other.
Browser and OS
- Browser: Chromium 141.0.7390.37, headless, 1440×900, DPR 1, service workers blocked; Playwright-core 1.58.2; Node 24.21.0.
- Host: Linux sandbox with 4 vCPU (DO-Premium-AMD), capped by its cgroup at 2 CPUs and 4 GiB.
- Other tenants: a mean of 0.33–0.70 CPU per 2 Oct block, at most 1.12 CPU at p90 of 1 s samples, with steal ≤ 0.03 CPU.
- Caveat: the large flows run into the cgroup's own CPU throttle. Absolute times here are a constrained VM's, not a laptop's; the A/B ratios carry over.
Relevant log output
The CPU profile of the narrow, self time, resolved through the build's sourcemaps:
27028 ms (anonymous) @ nm:@tanstack/query-core/build/modern/query.js:150 ← observers.filter(x => x !== observer)
5511 ms removeObserver @ nm:@tanstack/query-core/build/modern/query.js:148
1804 ms react-dom commit
1734 ms (garbage collector)
Activity
test(platform): pin the settings read's probe lane, note unsubscribed…
fix(platform): read the session probe without an observer per read
fix(platform): let a gated read ask for the probe itself
fix(platform): stop subscribing every backend read to the session pro…
yannickmonney commentedon Oct 2, 2026
#4067 rechecked against this issue's original workload. #4067 is merged as
2a169f4c7. The recheck ran in the TALE-361 performance occurrence of 2026-10-02 11:15 Zurich, run4f013cc1.Setup. The kit and fixture are the ones above:
vite preview;ROLE=api, on a scratch Postgres;ABBA blocks compare
9b91fb64a, the merge's first parent, with2a169f4c7, one heavy operation at a time. Medians, with min–max:9b91fb64a2a169f4c7(#4067)TASK-P4: < 1 sOn the 50-task board nothing regressed:
9b91fb64a2a169f4c7The dialog rows come from a second ABBA run, under heavier load from other tenants.
What the numbers say
The evidence is in the TALE-361 task box: receipt
2026-10-02T1115, and a bundle with raw JSONL samples and per-second host monitors.fix(platform): resolve a board card's automation owner from the board
test(platform): give the browser suites' contract mock its new export
perf(platform): mount only the cards near a long board lane's view
perf(platform): give board cards one directory and lazy pickers
perf(platform): leave the long task columns out of a board read
yannickmonney commentedon Oct 5, 2026
TALE-361 recheck of main's 5 Oct perf batch against this issue's original workload. Every timed budget item is met on main, and the keyboard check passes.
How it was run
e9c6a8fb3, the commit before the batch, against main315f216b3.7cdefb913,c5894663e(windowed board lanes),9981cbf3a,f18ecf0b1,437fe9fa4,6978c8e60,d44a770a9and315f216b3, plus fix(platform): freeze the compose draft while it sends #4362's merge3ba3b8679.vite preview, the backend withROLE=api, my own Postgres 16.14, and no egress.e9c6a8fb3315f216b3The per-block medians repeat within each arm. For example, the in-app open was 22.4 s and 20.2 s in the two base blocks, and 0.82 s and 0.76 s in the two main blocks.
The rest of the budget
services/platform/app/hooks/session-probe-observers.test.tsx(test(platform): pin session-probe gate branches and batch notifications #4191) pins the shared session-probe observers flat. It is in both arms.not-a-finding.md): find in page and a screen reader's browse mode reach a long lane's tasks only once they are near the view.TASK-P5.Notes
The raw samples and the kit are in TALE-361's
tale-361-perf-evidence-bundle.tar.gz, underocc-20261005T1915/:bench4.mjs,ab-4062.sh,probe-keyboard.mjsand the summaries.4 remaining items
perf(platform): keep the Home panel out of a board's ?task= changes
perf(platform): keep the Home panel out of a board's ?task= changes
perf(platform): keep the Home panel out of a board's ?task= changes
perf(platform): keep the Home panel out of a board's ?task= changes
perf(platform): keep the Home panel out of a board's ?task= changes
perf(platform): keep the Home panel out of a board's ?task= changes
perf(platform): keep the Home panel out of a board's ?task= changes
perf(platform): keep the Home panel out of a board's ?task= changes
perf(platform): keep the Home panel out of a board's ?task= changes
perf(platform): keep the Home panel out of a board's ?task= changes
perf(platform): keep the Home panel out of a board's ?task= changes
perf(platform): keep the Home panel out of a board's ?task= changes
perf(platform): keep the Home panel out of a board's ?task= changes
perf(platform): keep the Home panel out of a board's ?task= changes
perf(platform): keep the Home panel out of a board's ?task= changes