All numbers below were measured on 2026-11-10 on the development machine:
Windows 11, Docker Desktop (WSL 2) with 12 CPUs and 7.4 GiB of memory, the
full Compose stack (JUDGE_WORKERS=2, JUDGE_PARALLEL_TESTS=4), and k6
1.3.0 running in Docker on the same machine. A Linux server will differ;
rerun the scripts on the target host before relying on the numbers.
performance/k6/browse.js simulates anonymous visitors. Each iteration loads
the page, the contest list, a contest, its standings and the leaderboard, all
through nginx. The data set is the demo seed: 3 contests and 6 users.
docker run --rm -i --add-host=host.docker.internal:host-gateway \
-e BASE_URL=http://host.docker.internal:3200 \
grafana/k6:1.3.0 run - < performance/k6/browse.js| Run | Load | Requests | Throughput | p95 latency | Errors |
|---|---|---|---|---|---|
| Realistic | 50 VUs, 1-2 s think time, 2 min 45 s | 7,156 | 42 req/s | 19.7 ms overall; standings 25.8 ms | 0 % |
Stress (-e VUS=100 -e THINK=0) |
100 VUs, no think time | 122,476 | 742 req/s | 263 ms overall; standings 288 ms | 0 % |
All thresholds passed (p95 below 300 ms for lists, below 500 ms for standings and the leaderboard).
performance/k6/judge.js logs in the five demo users. Each user submits a
correct solution to "Count Primes" (n ≤ 10⁶, 10 tests) 6 times, which is the
per-user rate limit, so 30 submissions arrive at once. The script measures the
time from submit to verdict.
docker run --rm -i --add-host=host.docker.internal:host-gateway \
-e BASE_URL=http://host.docker.internal:3200 -e LANGUAGE=python \
grafana/k6:1.3.0 run - < performance/k6/judge.js| Language | Accepted | Burst drained in | Throughput | Time to verdict (min / median / p95) |
|---|---|---|---|---|
| Python | 30/30 | 15.8 s | ≈ 1.9 submissions/s | 1.7 s / 8.5 s / 14.7 s |
| JavaScript | 30/30 | 21.4 s | ≈ 1.4 submissions/s | 2.1 s / 12.0 s / 20.1 s |
| C++ | 30/30 | 1 min 49 s | ≈ 0.28 submissions/s | 9.4 s / 64 s / 105 s |
| Java | 30/30 | 2 min 24 s | ≈ 0.21 submissions/s | 14.2 s / 81 s / 139 s |
The minimum is what a single submission costs on an idle judge. The rest is time spent waiting in the queue.
Compiled languages are slow because Piston compiles the program again for every test: 10 tests mean 10 compilations. Java also compiles inside the run stage (see judge.md). Ways to improve this, in order of effort:
- Raise
JUDGE_WORKERSon a host with more cores. - Fewer, larger tests for problems that are mostly solved in compiled languages.
- Compile once and run every test from one Piston job, using a generated runner script that feeds each input and separates the outputs. This needs careful per-test time accounting and is not implemented.
The demo data is too small to show query plans that matter, so the hot queries were measured on a copy of the schema with synthetic data: 5,000 users registered for one contest and 200,000 judged in-contest submissions (160,127 of them count for standings), plus 1,000 queued submissions. Same PostgreSQL 17 image, same machine.
| Query | Before | After | Change |
|---|---|---|---|
Judge queue claim (FOR UPDATE SKIP LOCKED) |
78 ms: walked the primary key, because the index on (available_at, id) cannot serve ORDER BY id |
0.14 ms: index scan on the partial index (id) WHERE status = 'QUEUED' |
migration V2__queue_index_by_id.sql |
| Standings, first page of 50 (all SQL of one request, 5 runs) | 2.5-3.1 s: three passes, each with a materialized CTE self-join | 0.41-0.44 s: one window-function pass in index order, total via count(*) OVER (), page cells limited to the page's users |
StandingsService |
| "My submissions", newest 20 | 1.8 ms: index scan on idx_submissions_user_created |
— | — |
The new standings query returns exactly the same cells as the old one (checked
with EXCEPT in both directions on the synthetic data), and StandingsIT
covers scoring, ranks and paging.
0.4 s per standings request is acceptable for a contest of this size, but at the stress-test request rate it would saturate the database. If large contests become common, cache the standings per contest for a few seconds.
npm run build (Vite 7, production):
| Asset | Size | gzip |
|---|---|---|
| Entry JavaScript (React, router, Redux Toolkit, app shell) | 425 kB | 137 kB |
| Entry CSS | 25 kB | 5.4 kB |
| Markdown renderer (lazy, problem pages) | 168 kB | 51 kB |
| Code editor: Monaco (lazy, problem page only) | 3.4 MB | 0.88 MB |
| Editor worker (lazy) | 276 kB | — |
Every page is a lazy route. Monaco is bundled rather than loaded from a CDN, to
keep the strict CSP (script-src 'self'), and is downloaded only when a
problem page opens. Static assets have content hashes and are served with
Cache-Control: immutable.
The performance/first.html and second.html bundle reports of the original
Create React App build were removed, because they describe code that no longer
exists.