Skip to content

perf(fs): buffer benchmark-sized ext4 outputs #77

Closed

Description

@zackees

Context

The retained Rust benchmark on GitHub Linux produces roughly 356–447 MiB executables. Exact captured-link evidence shows output emission is the dominant remaining reld phase.

The first implementation attempted direct kernel range copies for unchanged ELF sections. Exact benchmark run 32877973437 rejected it: improvement against the paired issue baseline was only 9.6% for no-LTO, 7.8% for ThinLTO, and 3.5% for full-LTO, below the required gate.

The same run exposed the better optimization through the existing output-mode control: buffered output measured 354.31, 325.04, and 324.50 ms, beating the direct-copy default by 11–14%. An independent exact run from PR #76 showed the same ordering in all three modes.

Resolution

On Linux ext4, automatically use the existing BufferThenWrite implementation for output sizes in the measured 256–512 MiB range. Preserve mmap below and above that range, preserve the existing Btrfs/vfat policy, and preserve explicit --mmap-output-file and --no-mmap-output-file overrides.

The upper bound is intentional: the evidence covers benchmark-sized links, while buffering multi-gigabyte outputs could create unacceptable peak-memory use.

Acceptance criteria

  • Commit a RED test proving a 256 MiB ext4 output does not currently select the measured winning mode.
  • Make 256–512 MiB Linux ext4 outputs select buffered output by default.
  • Keep smaller ext4 outputs and outputs larger than 512 MiB on mmap.
  • Keep unknown filesystems on mmap and preserve the existing Btrfs/vfat buffered behavior.
  • Preserve explicit output-mode overrides.
  • Update CLI help so mmap is not described as the universal default.
  • Remove ext4 preallocation that is unreachable under the new automatic policy.
  • Pass focused Linux tests and formatting/static checks.
  • Publish a fresh exact-SHA, three-platform benchmark run.
  • Pass the strict paired Linux performance gate in no-LTO, ThinLTO, and full-LTO.
  • Keep macOS and Windows behavior and correctness gates green.

RED to GREEN

  • RED: f764c8ef requires the measured buffered policy and fails before implementation.
  • GREEN: 2c34c31c implements the bounded policy and its safety boundaries.

Published evidence

Exact final-SHA run: 32881046576

Mode final reld paired baseline improvement default vs explicit mmap
no-LTO 361.5 ms 25.3% 12.7%
ThinLTO 332.7 ms 22.3% 11.8%
full-LTO 338.3 ms 17.5% 9.1%

Startup was 2.0 ms, separately reported and not subtracted. Linux, Windows, macOS, graph rendering, exact SHA, freshness inputs, executable validation, and no-silent-N/A gates all passed.

Decisions

  • The failed direct-copy experiment remains visible in branch history and is reverted rather than hidden.
  • Published measurements remain raw; startup is reported separately and is not subtracted.
  • The benchmark workload, LTO modes, exact-SHA gate, history identity, and correctness oracle remain unchanged.
  • Scope is Linux ext4 only because that is where the repeated exact evidence was collected.

Activity

  1. changed the title [-]perf(elf): direct-copy large unchanged input sections[/-] [+]perf(fs): buffer benchmark-sized ext4 outputs[/+] on Aug 25, 2026
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions