Skip to main content
Every app is served from one origin (tuturuuu.com/<app>) through the apex gateway. Theme changes and app switches should feel instant: the theme is a class swap with no request, and the shared shell (sidebar, top bar, account menu) stays stable between apps. This page holds the benchmark that checks this and the numbers each optimization is measured against.

Running the benchmark

The benchmark is read-only. It signs in as a QA user and never writes data, apart from closing first-run dialogs in that QA user’s own workspace.
BENCH_APPS (cold loads) and BENCH_SWITCH (the app-switch sequence) override the default app lists. Point the origin at a staged 0% Worker version or a local production build to measure a change before promotion. Do not run the benchmark against a dev server, because dev bundles skew every number. The benchmark measures:

Baseline (2026-11-25, production)

Chromium headless, 1440×900, from Vietnam, signed in as a Pro staff QA user. These are medians of 3 samples. Live production varies by about ±30%, so compare a change with a run taken at the same time and place.

Theme toggle

The class swap itself was already cheap. It caused no request, no reload, no React remount and no layout shift. The theme also already follows the user across apps, because every app on the shared origin reads the same theme localStorage key and next-themes syncs other tabs through the storage event. The switch still looked slow, because every element with transition-colors or transition-all animated to the new palette for 300-500 ms. next-themes’ disableTransitionOnChange does not fix this in Chromium. It calls getComputedStyle(document.body) without reading a property, which does not flush styles, so transitions still start. Injecting that exact sequence on production left all 92-1403 transitions running.

App-to-app switch (warm context)

CLS was 0 for every navigation. Every switch is a full document navigation. None of the pages has Speculation Rules, and every HTML response is Cache-Control: private, no-store, which also blocks the back/forward cache (MainResourceHasCacheControlNoStore, JsNetworkRequestReceivedCacheControlNoStoreResource).

Cold load (empty cache)

Chunk reuse across apps

This was measured over 610 distinct scripts from the eight cold loads.
  • About 2.5 MB is identical content under the same URL. That is the /_f/dashboard chunks shared by the web-hosted surfaces (dashboard, Drive, Chat).
  • Only 106 KB is identical content under different URLs. Each satellite (/mail/assets, /calendar/assets, /tasks/assets, /finance/assets, /meet/assets) bundles its own copy of React, @tuturuuu/ui and vendor code, with different chunk boundaries and hashes. Serving the same files from one shared path does not fix this on its own. The satellites first need one shared build of the common packages.
  • About 32 MB is app-unique, so a user’s first visit to each satellite re-downloads 0.7-2.6 MB of JS.

Ranked opportunities

  1. Server time (TTFB 1.4-6.2 s on satellites, including revisits). This is the largest cost of every app switch. Tasks spends about 5-6 s before the first byte. Profile the per-request session and workspace resolution and the Supabase round trips in the satellite Workers. Cache the shell data (user, workspaces, apps list) with stale-while-revalidate.
  2. Per-app vendor and UI bundles (0.7-2.6 MB per first visit). Share one build of React and @tuturuuu/ui across satellites behind one immutable path, or prefetch the next app’s entry chunks.
  3. Cross-app navigation. Add Speculation Rules (prefetch, then prerender for sidebar app links) and cross-document View Transitions for the shell. Restore back/forward cache eligibility where no-store is not needed for safety.
  4. Theme swap animation (300-500 ms). Fixed by InstantThemeSwap below.

Theme switching contract

Every app’s theme provider spreads tuturuuuThemeProviderProps from @tuturuuu/ui/custom/theme-provider-preset and renders <InstantThemeSwap nonce={nonce} /> from @tuturuuu/ui/custom/instant-theme-swap inside it. This covers the shared satellite providers (providers.tsx, public-providers.tsx), web, workspace, Mail, Calendar, Tasks, Meet, Mastermind, Chat, Contacts, Forms, Learn, Mind, Nova, Pay, Teach, Colab and the native apps shell. The guard watches the light/dark class on <html> and acts before the next frame, whether the change comes from the menu, another tab or the OS preference. It flushes styles once while transitions are disabled, so the new colors become the starting values and nothing animates. Per the CSS Transitions spec, the flush also cancels any transition already in flight, such as a sidebar collapse, which jumps to its end state at the moment of the switch. The injected rule carries the request CSP nonce. The guard was measured by injecting it into the current production pages (the numbers for the shipped build follow once it deploys): Regression coverage:
  • apps/web/e2e/theme-switch.noauth.spec.ts drives the swap through the cross-tab storage path. It asserts no main-frame document request, CLS 0, no color transitions, and the class applied within 250 ms of the event landing. It is read-only. The web e2e global setup accepts only local origins, so to check a deployed origin (production or a 0% Worker version), run the file with a Playwright config that drops globalSetup and sets BASE_URL. Subframes such as the Turnstile widget may re-theme themselves and are excluded.
  • packages/ui/src/components/ui/custom/instant-theme-swap.test.tsx and theme-provider-preset.test.tsx pin the guard and the shared options.
A new app shell must use the preset and render the guard. Do not set disableTransitionOnChange as a substitute.