Skip to content

perf: summarize size report - #64

Merged
lukeed merged 1 commit into
mainfrom
sizes
Oct 15, 2026
Merged

lukeed merged 1 commit into
mainfrom
sizes

Conversation

@lukeed

@lukeed lukeed commented Oct 15, 2026

Copy link
Copy Markdown
Owner

Closes #61. Stacked on #63.

The size report after "done" read every output file and compressed it with gzipSync on the main thread, then printed one line for each file. On a 10,000-page site, that took about 1.1 s and printed 10,108 lines.

  • Up to 50 files, the report is the same table as before.
  • Above 50 files, it prints the total size of each extension, and one line for each script and stylesheet, with its gzip size:
  bench/site/public/  10,105 files · 90.33 MB
    .html                89.73 MB 10,101 files
    .xml                583.55 kB 1 file
    client.CJFnUKLj.js    9.82 kB │ 3.51 kB
    main.DFNHBuxH.js       616 B  │  408 B
    style.f6d61394.css    4.66 kB │ 1.34 kB
  • Only the files that the report lists are read. Every other file costs one stat. The report reads the folders in parallel, since a large site is mostly folders, one for each page. It compresses 8 files at a time, off the main thread.
  • cli.md and the readme of bongo describe the report.

Benchmark

bun run bench site, interleaved A/B against #63 on an M1 Max with Bun 1.4.3: two rounds each, median of 5 runs per round.

10k-page site #63 this PR change
wall 5.16 s, 5.32 s 4.19 s, 4.25 s −19%
user 3.80 s, 3.81 s 3.26 s, 3.27 s −14%
peak RSS 597 MB, 574 MB 548 MB, 543 MB −5 to −8%
listing sizes stage 1.07 s, 1.08 s 0.31 s, 0.17 s

The stage now adds about 3 MB of RSS, against 35–42 MB before. The build writes the same bytes.

Tests: 2 new tests, for the table and for the summary. All 808 pass, tsc -p . and tsc -p build are clean, and bun run build passes.

The size report after "done" read and gzipped every output file on the
main thread, and printed one line for each. Up to 50 files, it still
does. Above 50, it prints the total of each extension, from one `stat`
for each file, and gzips only the scripts and stylesheets, 8 at a time
off the main thread. It reads the folders in parallel, since a large
site is mostly folders, one for each page.

10k-page bench: the "listing sizes" stage takes ~0.1-0.3 s instead of
~1.1 s, and adds ~5 MB of RSS instead of ~40 MB. Wall time of the
build: ~5.0 s -> ~4.2 s.

Closes #61
@lukeed
lukeed changed the base branch from stream to main October 15, 2026 18:38
@lukeed
lukeed changed the base branch from main to stream October 15, 2026 18:42
@lukeed
lukeed changed the base branch from stream to main October 15, 2026 18:42
@lukeed
lukeed merged commit fea99af into main Oct 15, 2026
@lukeed
lukeed deleted the sizes branch October 15, 2026 18:47
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.

cli: the size list reads and gzips every output file

1 participant