Repository navigation
Conversation
The dev server sent text files, such as .md, .txt, and .xml, with no charset, so browsers read their UTF-8 as Windows-1252: an em dash showed as '—'. Text, JSON, XML, and JavaScript now say UTF-8.
A layout names other versions of a page with <bongo:alternate>, which becomes a <link rel="alternate">. For text/markdown, bongo also writes the page's source, under its title and summary, at the route plus .md ($utils.url.ext): read from disk when written, lazily in dev. Output files now render after every page, so they and data modules see each page's alternates in $pages. Passed-through element attributes are no longer escaped twice.
Each docs page gets a Copy page button, with Copy as Markdown and View as Markdown, from its <bongo:alternate> Markdown copy. The site also writes /llms.txt, grouped as in the sidebar.
A page with no Markdown source failed the build when its layout named a Markdown copy. A template cannot tell which pages are Markdown, so one layout could not serve a mixed site. Such a page now gets no copy and no <link>.
A guide for Markdown copies and llms.txt, the <bongo:alternate> and url.ext references, alternates in $pages, and output files that render after every page.
A client navigation replaced the whole body, so a scrolled sidebar went back to the top. An element with transition:persist now moves into the new page in place of the element with the same key, and keeps its scroll, focus, and state.
The sidebar persists across navigations and marks the new page itself. On a phone, opening the menu centres the current page.
The llms.txt guide is now three: Markdown copies (with the copy buttons), Alternates (feeds, translations, and $pages), and Create an llms.txt.
How to build a site in more than one language with frontmatter and $pages: hreflang links, <html lang>, layout text in data/, lists in one language, and a sitemap with each version. Alternates now points there for translations.
On a phone the open menu covered the Menu button, so it could not be closed. The menu now opens below the bar, the button shows a close icon, and the menu and the page outline close each other.
'Render dynamic images' is now 'Dynamic images'.
The CLI tests picked a random port and expected dev to bind exactly that one. A port that another program held, such as 7000 for macOS AirPlay, made dev move to the next port and the test fail. The tests now ask the OS for a free port.
`bun run bench` builds a generated 10,000-page Markdown site and the docs site. Each run is a new `bongo build` process, so the peak RSS of each run is its own; mitata times work in one process and cannot get this number. It reports wall, user, and sys time and peak RSS, and a sha256 of public/ to prove that two refs write the same bytes. One more run goes through bench/stages.ts, which prints each build stage, while `ps` samples RSS, to show which stage raises the peak. The docs site stays a second target, not the large input: it scales badly as a copy, because each page lists every docs page and renders an Open Graph card. Refs #56
The profile adds a second run through bench/stages.ts with `--heap`: at each stage line it runs a full GC and reads the live JS heap. It is a separate run, because its GCs lower the RSS that the plain run samples. Refs #56
`pool(limit)` runs jobs alongside other work, at most `limit` at once. A failed job is kept until `add` or `drain` throws it, so it is never an unhandled rejection, and `drain` waits for every job first. Refs #56
A regex match shares the memory of the string it came from, in JSC and in V8. The placeholders of each page live in the `bundles` map until the build ends, so each one kept the HTML of its page alive. On the 10k-page bench, the live heap after rendering was 253 MB, of which about 180 MB was page HTML held this way. Refs #56
`bongo build` writes each page as it renders, through a pool of 64 writes, and drops each page body once it renders. After the bundler flush, it reads each page again, puts in the asset URLs, runs `$hooks.transform`, and writes it. Dev and narrow builds still hold every page, so a failed rebuild leaves the last good build. A failed `bongo build` waits for its writes, then empties `public/`, so it leaves no page with placeholders in it. 10k-page bench, median of 5: peak RSS 1198 MB -> 814 MB, wall 6.43 s -> 5.79 s. The output is the same, byte for byte. Refs #56
`add` reserved its slot only after an await, so adds that waited at once all started: `pool(1)` ran 4 jobs together. The pool now hands a freed slot to one waiting add, as `images.slot` does. A job that throws at once fails the pool like one that rejects, and a limit that is not a whole number above 0 throws.
`Promise.all` rejects at the first failure while its other writes go on. A failed `bongo build` empties public/, so such a write could land after the cleanup. `utils.settle` waits for every promise before it throws the first failure. `fs.list` and the write groups of a build use it. Refs #56
`toLocaleDateString` with options builds a new formatter for each of the ~20,000 dates that the bench site renders, which cost ~0.4 s. One `Intl.DateTimeFormat` gives the same text.
The size list after "done" reads and gzips every output file. On the 10k-page bench it takes ~1.1 s and raises peak RSS by ~40 MB, but it ran inside the "writing pages" stage. Its own stage shows it in `--debug` and in the bench. #61 tracks the cost itself.
At the start of each stage, the profile now reads the RSS, the bytes that mimalloc has committed and has in use, and the JS heap, and the live heap after a full GC in a second run. Thus a gap between RSS and live data shows if it is garbage that the GC has not collected, memory that the allocator keeps, or memory outside mimalloc. The profile also prints the stderr of its run, for allocator dumps. Refs #56
`limit(size)` runs each job once fewer than `size` jobs run, and gives back the job's result. Unlike `pool`, a call ends when its job ends, so a caller such as `fs.list` still waits for the work itself.
`fs.list` started the read and the loader of every content file at once. A build now runs 16 at a time. It also reads each file into a view and not a copy, and takes the frontmatter signature before the loader runs, so the decoded source is not kept across it. 10k-page bench, 3 runs each (wall / sys / max RSS in "reading content/"): no limit 5.22 s / 15.2 s / 387 MB; 64: 5.05 / 13.5 / 330; 32: 4.87 / 12.9 / 313; 16: 4.97 / 13.0 / 299; 8: 4.93 / 13.1 / 323. Then 16 against 32, 5 runs, two rounds each: same wall time, and median peak RSS 605 and 602 MB against 629 and 675 MB. Refs #56
This was referenced Oct 15, 2026
Merged
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #56.
bongo buildnow writes each page as soon as it renders, so it no longer holds every page in memory. Dev and narrow rebuilds still hold every page, so a failed rebuild leaves the last good build serving.$hooks.transform, and writes the page again. Rereading and rewriting 10k pages costs about 0.4 s; a second render pass would cost about 1.3 s, and would run each template twice.bundler.placeholders()copies each match. A regex match shares the memory of the whole string that it came from, so the placeholders of each page kept the HTML of that page alive until the build ended. On 10k pages, that was 180 MB of the 253 MB live heap after rendering.bongo buildwaits for every write that it started, then emptiespublic/, so it leaves no page with placeholders in it.utils.settle(wait for every promise, then throw the first failure) replacesPromise.allwhere a failure could leave writes running.pool(limit),limit(size),settle(list).--debugnames a new stage,listing sizes, for the size report after "done".Benchmark
bun run bench(a newbench/workspace) builds a generated 10,000-page Markdown site and the docs site. Each run is a newbongo buildprocess. It reports wall, user, and sys time, peak RSS, and a sha256 ofpublic/. A stage profile adds, at the start of each stage: RSS, the memory that mimalloc has committed and has in use, the JS heap, and the live heap after a full GC.Interleaved A/B on an M1 Max with Bun 1.4.3: two rounds each, median of 5 runs per round. "Before" is the build code of
main, with the same bench.Both sites write the same bytes as before: the sha256 of
public/does not change. On the docs site (109 files), the wall time does not change, and peak RSS is about 3 MB higher.The live heap now peaks at about 125 MB. Most of the gap to RSS is garbage that JSC has not collected yet:
BUN_JSC_forceRAMSize=1073741824lowers peak RSS by about 230 MB. Some is memory that mimalloc keeps:MIMALLOC_PURGE_DELAY=0lowers it by about 100 MB. These are diagnostics, not defaults.Follow-ups: #59 (the last build stays in memory after
build()returns), #60 (emptyingpublic/takes 1–2 s), #61 and #62 (stacked PRs on this branch).Notes
bongo build,$hooks.transformnow runs at most 64 at a time, and gets the page text as read back from disk. Thus a lone surrogate arrives as U+FFFD. The written bytes do not change.bun run benchrebuilds the packages first, so it always measures the current source.Tests: 14 new tests, for streamed writes, failure cleanup,
pool,settle,limit, and placeholder memory. All 806 pass,tsc -p .andtsc -p buildare clean, andbun run buildpasses.