Skip to content

Reduce dense calendar and task interaction latency and enlarge Scratchpad checkboxes - #693

Merged
callumalpass merged 6 commits into
mainfrom
optimize-10k-task-paths
Nov 28, 2026
Merged

callumalpass merged 6 commits into
mainfrom
optimize-10k-task-paths

Conversation

@callumalpass

@callumalpass callumalpass commented Nov 28, 2026 •

Copy link
Copy Markdown
Owner

Refs #602

Calendar only needs the collection-wide alias list when a materialized recurrence child exists. Both repository adapters check their metadata first and retain the existing full lookup when it is needed. When manual-order metadata arrives for an already ordered Upcoming view, React can reuse the same execution and calendar projections. The agenda measures the strip after restoring weekday labels when navigation redraws the cells. Mounting virtual task rows alone skips that synchronous layout read in browsers with ResizeObserver.

Month layout previously scanned every occupied level from row zero for each event. The existing calendar package patch now tracks the end of the last span on each level and advances a cursor within each start column. Each column scans a level at most once. Civil-day grouping also reuses the bucket for implicit one-day entries with the same start.

Sidebar counts are reused for the current date, runtime timezone and deletion mask until task metadata changes. Project shortcuts and drawer relationships now resolve repeated project links once per computation. Choosing a search suggestion or a recent search submits immediately. Typing retains its debounce.

At 390 × 844 CSS pixels on the baseline, the Scratchpad checkbox named “Mark task complete” was 17 × 17 with a fine pointer and 44 × 44 with a coarse pointer. The narrow-screen layout now reserves a 44 × 44 button for both. The phone tests check all four corners, toggle from a corner, check horizontal overflow and run axe.

Chromium measurements at 24ce0e20

Baseline cd1596b485328e79e6166d060d57f5ad03eb5412 and head 24ce0e20d8d8a48ab67efec13798d84357a95ee0. Both are optimized E2E builds on loopback using the deterministic demo repository. This measures local application and browser time. Connected-repository behavior is covered by the unit suite.

Twenty-one paired rounds per collection size alternate baseline/head and head/baseline. “Cold” is the first workflow in a fresh browser context. “Warm” repeats the workflow after a reload in that context. Actions end after their visible result and two animation frames. All rows are in milliseconds, with the median followed by nearest-rank p95 (the second slowest of 21). Chromium 149.0.7827.55 pinned to four physical cores on the shared Linux workstation, 1280 × 800, en-US, reduced motion, and a fixed clock at 2026-11-04 12:00 UTC.

Nine full rounds survived a preview-server interruption. The partial tenth round was discarded in full. The remaining twelve started with the candidate first to preserve alternation across the restart. The same built assets were served on both runs. Host load rose during the later rounds and both builds slowed. All 84 completed contexts and 2,016 timings from the selected full rounds are included.

At 10,000 tasks, warm completion and count refresh improved from 178 / 542 to 117 / 330 ms (median / p95), faster in 19 of 21 pairs. Warm drawer edit, save and reopen improved from 476 / 1,295 to 367 / 1,076 ms, faster in 20 pairs.

Cold Upcoming and Calendar had lower p95s, but higher overall medians. Upcoming was faster in 16 pairs (median paired difference −105 ms) and Calendar in 17 (−65 ms). Per-build medians and the median difference within pairs are separate statistics. Cold capture, drawer open and edit/reopen had higher p95s. Typed tag filtering also had higher p95s in both modes.

The 60-task control improved on tag selection in all 21 cold and all 21 warm pairs. Several interactions regressed. Cold Calendar rose from 128 / 331 to 145 / 403 ms. Warm drawer open rose from 113 to 144 ms at the median and was slower in 16 pairs. Cold edit/save/reopen p95 rose from 422 to 604 ms. The small-collection zero-regression target remains open.

10,000 tasks

Action (ms) Cold base p50 / p95 Cold PR p50 / p95 Warm base p50 / p95 Warm PR p50 / p95
open 1,811 / 6,093 1,620 / 5,706 2,004 / 5,710 1,697 / 4,503
Upcoming 780 / 3,338 813 / 2,265 786 / 2,619 670 / 1,874
Calendar 687 / 2,612 783 / 1,777 784 / 2,223 603 / 1,571
Search 64 / 222 64 / 132 81 / 199 64 / 272
Today 466 / 1,387 416 / 1,425 462 / 1,665 384 / 1,303
capture + project count 807 / 2,292 832 / 2,709 864 / 2,292 736 / 2,471
choose tag 272 / 395 117 / 479 270 / 404 109 / 344
title filter 213 / 401 220 / 387 224 / 374 219 / 250
tag filter 212 / 293 216 / 307 216 / 274 217 / 421
open detail 224 / 553 180 / 770 241 / 552 145 / 441
edit, save + reopen 467 / 1,152 400 / 1,392 476 / 1,295 367 / 1,076
complete + project count 152 / 410 116 / 236 178 / 542 117 / 330

60 tasks

Action (ms) Cold base p50 / p95 Cold PR p50 / p95 Warm base p50 / p95 Warm PR p50 / p95
open 673 / 1,400 678 / 1,121 500 / 1,176 515 / 906
Upcoming 223 / 869 250 / 501 272 / 703 244 / 548
Calendar 128 / 331 145 / 403 111 / 357 117 / 250
Search 48 / 79 47 / 60 42 / 95 48 / 64
Today 111 / 193 97 / 194 81 / 260 81 / 167
capture + project count 216 / 676 192 / 694 198 / 571 164 / 401
choose tag 274 / 414 120 / 164 265 / 508 108 / 180
title filter 211 / 229 210 / 262 212 / 258 215 / 237
tag filter 215 / 237 215 / 244 217 / 297 216 / 242
open detail 143 / 348 144 / 267 113 / 468 144 / 256
edit, save + reopen 240 / 422 224 / 604 218 / 545 239 / 471
complete + project count 47 / 103 55 / 119 49 / 84 49 / 84

Agenda scroll correction at 12a6df50

On 24ce0e20 the expanded-agenda regression failed five times in five runs. The calendar published a strip height of 52 px before its labels returned. The decorated strip was 70 px tall and covered the selected section by 17 px. With the correction, the published height is 70 px and the section starts 1 px below the strip.

All six calendar-polish tests passed. The previously failing case passed five times across the full file and four extra repetitions. All 26 selected Chromium accessibility and interaction tests passed, including fine- and coarse-pointer Scratchpad corner activation at 390 × 844. Each checkbox measured 44 × 44 px. Eight additional full-page axe scans at 60 and 10,000 tasks found zero violations. The unit suite passed 2,379 tests with 9 skipped. Typecheck, lint and the E2E build passed. The latency tables above cover 24ce0e20.

Verification at 24ce0e20

  • Nine rpnpm scripts exited successfully. The full unit run passed 2,379 tests with 9 skipped. Typecheck, formatting, importer and release checks passed. ESLint reported 13 warnings and zero errors. Production, self-hosted and optimized E2E builds passed.
  • The candidate matched the baseline on placements, levels and column counts across 1,200 deterministic generated month layouts.
  • Both Scratchpad pointer-mode tests passed at 390 × 844, including corner activation, horizontal overflow and axe. Both desktop agenda regressions passed for scrolling, focus, day totals and keyboard selection.
  • All 16 full-page axe scans returned zero violations across Upcoming, Calendar, search results and task details at both sizes and on both builds. These are loopback Chromium results. Production and native-device behavior still need separate verification.

Reproduce

Use separate worktrees for the two revisions above. In each worktree build the same E2E configuration. Serve the baseline on port 4963 and the candidate on 4964.

pnpm install --frozen-lockfile
rpnpm --pull dist run build:e2e
pnpm exec vite preview --host 127.0.0.1 --port 4963 --strictPort

From the candidate worktree, with both previews running and Playwright Chromium installed, run the comparison. Standard output contains every per-action sample in JSON.

mkdir -p out/bench-tmp
TMPDIR="$PWD/out/bench-tmp" TASKNOTES_BENCH_FOCUS=calendar-search TASKNOTES_BENCH_ROUNDS=21 \
  taskset -c 2-5 node scripts/bench-task-workflow.mjs http://127.0.0.1:4963 http://127.0.0.1:4964 > paired.json
jq -r '.results | to_entries[] as $build | $build.value | to_entries[] as $size | $size.value | to_entries[] | (.value | sort) as $ms | [$build.key, $size.key, .key, $ms[10], $ms[19]] | @tsv' paired.json

Run the unit, static, build and Chromium regression checks from the candidate worktree.

rpnpm run test
rpnpm run import:check
rpnpm run test:release
rpnpm run format:check
rpnpm run typecheck
rpnpm run lint
rpnpm run build
rpnpm run build:self-hosted
export PLAYWRIGHT_BASE_URL=http://127.0.0.1:4965
export PLAYWRIGHT_WEB_SERVER_COMMAND='pnpm exec vite preview --host 127.0.0.1 --port 4965 --strictPort'
pnpm exec playwright test e2e/phone.spec.ts --project=mobile -g 'Scratchpad draft checkboxes' --workers=1 --retries=0
pnpm exec playwright test e2e/agenda-window.spec.ts e2e/calendar-clarity.spec.ts --project=desktop -g 'dense agenda|named, counted' --workers=1 --retries=0
Reproduce the full-page WCAG A/AA scans on both previews
node --input-type=module - http://127.0.0.1:4963 http://127.0.0.1:4964 <<'JS'
import { chromium } from "@playwright/test";
import AxeBuilder from "@axe-core/playwright";
const browser = await chromium.launch();
try {
  for (const origin of process.argv.slice(2))
    for (const size of [60, 10000]) {
      const context = await browser.newContext({
        viewport: { width: 1280, height: 800 },
        locale: "en-US",
        timezoneId: "UTC",
        reducedMotion: "reduce",
        serviceWorkers: "block",
      });
      const page = await context.newPage();
      await page.clock.setFixedTime(new Date("2026-11-04T12:00:00Z"));
      async function scan(name) {
        const r = await new AxeBuilder({ page })
          .withTags([
            "wcag2a",
            "wcag2aa",
            "wcag21a",
            "wcag21aa",
            "wcag22a",
            "wcag22aa",
          ])
          .analyze();
        console.log(
          JSON.stringify({
            origin,
            size,
            name,
            violations: r.violations.map((v) => ({
              id: v.id,
              nodes: v.nodes.slice(0, 3).map((n) => n.target),
            })),
          }),
        );
      }
      for (const [slug, selector] of [
        ["upcoming", ".tnc-list-lead .task-row-title"],
        ["calendar", ".tnc-dg .tnc-item"],
      ]) {
        await page.goto(
          origin +
            "/views/" +
            encodeURIComponent("TaskNotes/Views/" + slug + ".base#" + slug) +
            "?demo=" +
            size,
        );
        await page.locator(selector).first().waitFor();
        await scan(slug);
      }
      await page.goto(origin + "/search?demo=" + size);
      const input = page.getByRole("searchbox", { name: "Search tasks" });
      await input.fill("Book the project room");
      const row = page.getByRole("button", {
        name: "Book the project room",
        exact: true,
      });
      await row.waitFor();
      await scan("search results");
      await row.click();
      await page.locator("#task-title").waitFor();
      await scan("task details");
      await page.context().close();
    }
} finally {
  await browser.close();
}
JS

@callumalpass
callumalpass merged commit cec6213 into main Nov 28, 2026
8 checks passed
@callumalpass
callumalpass deleted the optimize-10k-task-paths branch November 28, 2026 15:55
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