Skip to content

build: emptying public/ takes 1–2 s on a large site #60

Closed

Description

@lukeed

bongo build empties public/ before each build. On the 10,000-page site of bun run bench (#56), this takes 1.1–1.9 s. That is 20–35% of the wall time of the build: 5.2 s on branch stream. In the stage table of the bench, it is the start row.

Today

fs.empty() in packages/bongo/src/utils/fs.ts reads the top level of public/, then runs fs.rm(path, { recursive: true, force: true }) on each entry at the same time. It tries again when another remover works on the same tree.

Directions

  1. Delete the whole folder with one fs.rm, then make it again. Run the unsafe() checks first, as now.
  2. Rename public/ to a temporary name next to it, make a new empty public/, and delete the old folder while the build runs. The build must wait for the delete before it exits. The delete competes with the build for I/O, so measure the whole run, not only the start row.

Keep

  • bongo refuses to empty a folder that resolves to a source folder.
  • bongo deletes a symlink in public/, but never the file or folder that it points to. If public/ itself is a symlink, the link stays.
  • A second remover on the same tree does not fail the build.

Measure

bun run bench site: the start row and the wall time. The output hash must not change.

Activity

  1. added
    enhancement
    on Oct 15, 2026
  2. added 4 commits that reference this issue on Oct 15, 2026
    c621e98
    e9454b2
    ba5a136
    0f76139
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions