Skip to content

Speed up uncached leaderboard reads and page loading - #269

Merged
msaroufim merged 1 commit into
mainfrom
perf/fast-page-loads
Nov 4, 2026
Merged

msaroufim merged 1 commit into
mainfrom
perf/fast-page-loads

Conversation

@msaroufim

@msaroufim msaroufim commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Leaderboard detail pages could spend 10–23 seconds waiting for SQL, and every first visit downloaded a 3.66 MB uncompressed JavaScript bundle. This change makes the ranking reads use the existing covering indexes, disables per-request SQL JIT compilation, and returns account IDs directly so trend initialization no longer searches five usernames.

Split routes and the trend chart into separate bundles, include only the chart features and syntax grammars used by the site, keep navigation inside the React app, and compress scripts/styles/JSON. The entry script is now 530 KB uncompressed / 171 KB over gzip (95% less transferred). No new response cache or database schema changes; Modal and submission execution are unchanged.

Validation:

  • Compared real production rankings and metadata on boards 544, 763, and 776: identical results after excluding the added account ID. With JIT disabled for both versions, board 776 improved from 7,885 ms to 218 ms and board 763 from 688 ms to 388 ms. Initial public API measurements were 10.37s and 23.37s for boards 544 and 763.
  • 55 API/health/compression/security-filter tests pass, including tie handling, hacked submissions, bytea code storage, gzip content equivalence, and preserved byte ranges.
  • 45 relevant frontend tests pass; production build, changed-file ESLint, full Python Ruff check, and TypeScript no-emit check pass.
  • Browser-verified production build locally: rankings, modular chart, starter code, news, and client navigation, with no browser warnings/errors.
  • Existing full-suite failures were reproduced on the original commit: nine obsolete server-rendered-page tests and eight frontend tests. The updated navigation tests remove two frontend failures; six unrelated frontend failures remain.

Production rollout: deployed Northflank board image elfin-wing-5727, commit 51dde2b, on 2026-11-04. All 42 listed leaderboard APIs returned successful results (median 0.471s, maximum 1.795s). Board 544: 10.374s → 0.662s; board 763: 23.370s → 0.917s. Production entry script: 3,657,243 bytes → 171,134 transferred bytes with gzip (95.3% reduction). Live Chrome measured the vectorsum leaderboard API at 445.7 ms and reported no console warnings/errors. Health remains healthy. No Modal or submission services were changed.

@msaroufim
msaroufim merged commit 51dde2b into main Nov 4, 2026
1 check passed

This branch was successfully deployed

1 active deployment
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