Skip to content

perf(gen_build): skip gen-dir when BUILD.bazel is newer than sources#94

Open
english wants to merge 1 commit into
griffinbank:mainfrom
english:series/gen-srcs-mtime-skip
Open

perf(gen_build): skip gen-dir when BUILD.bazel is newer than sources#94
english wants to merge 1 commit into
griffinbank:mainfrom
english:series/gen-srcs-mtime-skip

Conversation

@english
Copy link
Copy Markdown
Contributor

@english english commented Apr 4, 2026

Adds an mtime check so directories whose BUILD.bazel is already newer than all source files are
skipped entirely. This adds ~2s overhead on cold runs (checking mtimes with no BUILD files present)
but reduces incremental (warm) runs from ~10s to ~1.8s.

Benchmark

examples/gen_srcs_bench (Hyperfine, 5 runs, 19607 namespaces)

  • cold (prepare: delete BUILD.bazel): 9.660s → 11.696s ± 1.943s
  • warm (no-op, all BUILD files current): 1.841s ± 0.090s

banksy (Hyperfine, 10 runs, 7208 source files, warm)

  • before: 3.018s ± 0.046s
  • after: 2.542s ± 0.042s
  • change: -15.8%

(written by Claude)

Adds an mtime check so directories whose BUILD.bazel is already newer
than all source files are skipped entirely. Adds ~2s overhead on cold
runs (checking mtimes with no BUILD files present) but reduces
incremental (warm) runs from ~10s to ~1.8s.

### Benchmark
`examples/gen_srcs_bench` (Hyperfine, 5 runs, 19607 namespaces)
- cold (prepare: delete BUILD.bazel): 9.660s → 11.696s ± 1.943s
- warm (no-op, all BUILD files current): **1.841s ± 0.090s**

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@english english force-pushed the series/gen-srcs-mtime-skip branch from 0152567 to fc9cca9 Compare April 4, 2026 21:03
@english english requested a review from a team April 4, 2026 21:08
@english english marked this pull request as ready for review April 4, 2026 21:09
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.

1 participant