Repository navigation
Conversation
Merged
About 3 in 1,000 temporary paths give lightningcss a hash that starts with "-" and a digit, which CSS escapes, as in `.-\31 kqhq_red`. The selector regex did not allow escapes, so the test failed now and then.
The test took a free port and expected dev to use the next one, but another process can hold that one too; dev then takes the next free port, up to 10 higher, as documented. The test now accepts that.
The test counted rebuild lines once the page showed the edit made during the first build, but dev can update the page before it logs that rebuild. The late line then counted as part of the burst, and the test saw 3 rebuilds. It now waits for that line first. Under CPU load it failed by the 4th run before, and passes 20 of 20 now.
`bongo build` emptied public/, then made every file again. On the 10k- page bench, emptying took ~1.6 s, and making 10k pages takes ~1.3 s where writing over them takes ~0.15 s. A streamed build now keeps the files of the last build and writes over them, then sweeps each file that it did not write. A failed build still empties public/. `fs.reuse` deletes each symlink, never its target, and indexes the rest. Before each write, it deletes a kept path that no write claimed and that is in the way: a file where a folder must go, a folder where a file must go, or a path that differs in case only, which a case- insensitive disk would write into. Writes that need the same path wait for that delete. 10k-page bench, repeat builds, interleaved, 2 rounds of 5 runs: wall 5.33 / 5.25 s -> 3.59 / 3.62 s, sys 16.0 / 15.8 s -> 3.6 / 3.7 s, same output bytes. Peak RSS 584 / 590 MB -> 704 / 690 MB: the build is faster than the GC, so more garbage is left when it peaks. Closes #60
Writing over public/ made the build faster than the GC, so rendering left more garbage, and peak RSS rose by ~110 MB. A streamed build now runs one full collection under Bun as it starts writing the pages again: on the 10k-page bench, peak RSS 713 MB -> 573-598 MB, wall time the same within 50 ms. `Bun.gc(false)` did not lower it. Dev and Node do not run it. Refs #60
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 #60. Stacked on #65.
bongo buildemptiedpublic/, then made every file again. On the 10,000-page bench, emptying took about 1.6 s. Making 10k pages takes about 1.3 s, but writing over the same files takes about 0.15 s. A streamed build now keeps the files of the last build, writes over them, then deletes each file that it did not write. A failed build still emptiespublic/. This is also the base for #66, which renders only what changed.fs.reusechecks the folder asfs.emptydoes, and refuses with the same message. It deletes each symlink in the folder, never its target, and indexes the rest.fit(file). It deletes a kept path that no write claimed and that is in the way: a file where a folder must go, a folder where a file must go, or a path that differs in case only. Without the last check, renamingAbout.mdtoabout.mdon a case-insensitive disk (the macOS default) would write into the oldAbout/folder, and the sweep would then delete the new page. Writes that need the same path wait for that delete.sweep()deletes each kept file that no write claimed, and the folders that this leaves empty.Bun.gc(false)did not help. Dev and Node do not run it.bongo buildwrites overpublic/, and deletes what it did not write.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. Each run builds over the output of the run before it, as a repeat build does.startstageThe output is the same, byte for byte. A first build into an empty
public/gains nothing from this change.Flaky tests
Three tests failed now and then before this branch, in
maintoo. Each fix has its own commit:site-css-modules: about 3 in 1,000 temporary paths give lightningcss a hash that starts with "-" and a digit. CSS escapes it, as in.-\31 kqhq_red, and the test's regex did not allow escapes.dev moves to the next free port: another process can hold the port after the test's port. Dev then takes the next free port, up to 10 ports higher, as documented. The test now accepts that.turns a burst of changes into one rebuild: dev can update the page before it logs the rebuild for that change, so the late log line counted as part of the burst. The test now waits for the line. Under CPU load, it failed by the 4th run before, and passed 20 of 20 runs after.Tests: 7 new tests, for
fs.reuse(kept files, symlinks, file and folder swaps, case, concurrent writes, refusal), writing over a last build, and the one collection. All 813 pass,tsc -p .andtsc -p buildare clean, andbun run buildpasses.