Files
DeepSeek-Reasonix/workers
YHH 88b9fa0869 perf: drop the dashboard's window-scan indexes, bake avatars as webp (#7258)
* perf(crash-worker): drop the window-scan indexes the dashboard loses to

Every dashboard aggregate is `WHERE date >= ... GROUP BY <other columns>`,
and each table's primary key already starts with `date`. Offering SQLite a
second index on the GROUP BY columns makes it prefer an ordered full-index
scan, which skips the window prune and reads every retained row back through
the table. The same query shape with a `date <` upper bound already picks the
primary key, which is why the previous-window delta was never slow.

Measured on seeded copies, 65 days retained against the 30-day window:

  metric_users  5.3M rows   31.6s -> 3.3s
  metrics       180k rows    807ms -> 88ms
  pings         568k rows    672ms -> 459ms

No query filters these tables by the dropped columns, so this also takes
their maintenance cost off the ingest path.

* perf(site): bake contributor avatars as 128px webp

The prebuild wrote whatever GitHub handed back straight to `<login>.png`.
Of the 98 baked files, 58 were actually JPEG behind a .png name, 19 came
back at 420x420 despite the ?s= hint, and the heaviest 120x120 avatar was
76 KB. The homepage renders all 98 at 60 CSS px.

Re-encode through sharp at twice the largest rendered size instead of
trusting the response. Avatars 823 KB -> 252 KB; the homepage drops from
842 KB to 371 KB, still 103 requests but a little over half the bytes.

sharp was already resolved in the lockfile as an astro dependency; it is
promoted to a direct devDependency so the prebuild does not rely on hoisting.
2026-08-03 11:57:50 +08:00
..