Skip to content

[perf] Webapp load-time wins (gzip, route-split, echarts tree-shake, compare cache) #137

Description

@VforVitorio

Webapp efficiency audit (2026-07-19) — the highest-leverage, lowest-risk wins to make loads/interactions more fluid. Ordered by impact. Full analysis in the audit notes.

  • nginx serves the JS bundle uncompressedwebapp/nginx.conf has no gzip on; (stock nginx:alpine ships it off), so prod users download 1.88 MB instead of ~612 KB. Add gzip on; + gzip_types. ~67% less transfer, 1-line, zero risk. Do first.
  • Route-level code-splittingsrc/app/router.tsx imports every page eagerly; Home downloads every tab. React.lazy() per route + a Suspense boundary → ~300-450 KB gzip off first paint.
  • ECharts full importecharts-for-react default does import * as echarts (~1 MB). Switch chart features to echarts/core + echarts-for-react/core + explicit use([...]) (line/gauge/scatter/custom + 7 components) → ~180-220 KB gzip. Pair with manualChunks so echarts is one shared async chunk.
  • Backend: compare Q-session path bypasses the warm session cachebackend/api/v1/endpoints/comparison.py:91-92 calls raw fastf1.get_session(...).load() instead of session_cache.get_loaded_session(...). This is the real cause of the ~14s cold compare. 2-line fix.
  • Prewarm the compare session on 2nd-driver pick (like prewarmTelemetry) so the fetch is warm by COMPARE.

Already good (do NOT change): the replay rAF clock, staleTime:Infinity, useLapTelemetries parallel-fetch + signature-memoization, the prewarm pattern, the backend session_cache LRU, nginx hashed-asset cache headers. @tanstack/react-table/react-virtual are already tree-shaken out of the shipped bundle (dead weight in package.json only).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions