Repository navigation
perf: batch sustained listing output with a lazy bounded buffer - #1156
Merged
Merged
Conversation
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.
Reduce ostream overhead for sustained non-interactive listings with a lazily allocated 4 KiB buffer. Short output keeps the existing path; terminal output, pagers and terminal-taking expressions keep their direct behavior.
Independent large-listing repeats improve about 0.9% on Linux and 4.4-4.5% on macOS. The measured macOS cases finish ahead of GNU find; Linux still trails it. The report preserves mixed small results and all adverse observations.
AG;DR
Implementation
BufferedListingOutputstreambuf owned by aunique_ptrinRunMain.sync()also flushes the underlying buffer so stderr's tie retains diagnostic ordering.Exact source and build provenance
Measured candidate
268bb2ef0f8b6887ac3924c94c9fb44d10f172a9versus prepared-guard baseline374c2588f876d054c82e017b3d3ad0b4b993dc41. This new PR is based on main after #1155 merged. The initial PR runtime and Bazel inputs matched the measured candidate, apart from #1155's constness correction for two test locals. The coverage follow-up moves the byte-identical buffer definition frommain.ccinto a private CLI header and adds a dedicated test target; admission and buffering behavior remain unchanged. Measurements still identify the original source and binaries; qualification of this later integration layout is recorded separately. Frozen binaries are never relabeled as this later integration commit.Both hosts built full and minimal production CLIs with
clang_release(full addsxff_full). Each configured query/copy immediately followed its own build. Retained evidence includes source/tree identities, binary SHA-256/size, build configuration and actual ThinLTO actions. Bazel servers stopped before elapsed timings.Validation and measurement
clang_opt/xff_fullwith cached results disabled: color, CSV, exact, exec, exit, pager unit/shell, parity, rg full/input/terminal/basic, sort and style. These are separate from timed production binaries.0.99146/0.99122; macOS0.95615/0.95496. Identical controls: Linux1.00161/0.99828, macOS1.00042/0.99629. Candidate/find: Linux1.08992/1.09534, macOS0.96307/0.94839.Storage, retention and limitations
Linux fixtures use verified tmpfs and recorded affinity. macOS uses five independently owned 2 GiB case-sensitive HFS+ RAM images, all UUID-matched and released. This measures memory-backed traversal rather than SSD throughput. Hosts were not used for our builds or heavy analysis during accepted timings.
Final archives in
/home/marcus/Documents/ondrogon.boerger.online, manifest-verified against contents:xff-lazy-listing-buffer-linux-20261109.tar.gz: 27,473,416 bytes, SHA-2561cf694372a3f0e78e3e228a6477a435f07e4a8a2cb13d210d2555c721c035066, 2,013 entries.xff-lazy-listing-buffer-macos-20261109.tar.gz: 16,253,106 bytes, SHA-2568714ff015878ead60cb0c53d6e6702da4a4c9c0fa0d9a4a670cd37790d0b2069, 1,644 entries; destination hash checked after copying.Archives retain exact source/binaries, link actions, tests, lint, raw rounds, output oracles, helpers, fixture/tool identities and storage journals. The prior immediate stack-owned buffer remains retained as a held experiment; it is not pooled with final results. Dynamic-library references are recorded, not a complete operating-system image. Continuous extended-production-v1 viewer integration and missing merged-PR publication remain separate work.
Current integration and coverage qualification
Current head:
fcf178c3041aef16f52f921d580d813a46dc3739, based on main94e785f02f6d4546484e6e224351eba814deb979.The private buffer header now has 16 committed memory-only stream-contract cases. Tests use production's ownership form: a const
unique_ptrowning a mutable stream buffer. They cover pending-byte ordering, large and exact-capacity bypass, character overflow, nonpositive writes, downstream short writes and synchronization failures, destructor restoration and tied diagnostic ordering. No coverage exclusions or threshold changes were introduced.The performance-analysis index links to the full existing report so GitHub's Markdown rendering request fits the service limit. The actual API render and replacement release-site CI checks passed. Original findings, measured images and all raw evidence remain preserved.
The complete 344-target release configuration passed on both hosts at the preceding integration heads; all results retain their exact source identities. The ownership-corrected test additionally passed fresh release tests and actual affected-file clang-tidy on both hosts before this push, and normal commit/push hooks passed with the Mac compile database present. Current-head qualification is complete on both hosts: 344-target release configuration, fresh execution of the 16-case affected unit target, actual
main.ccand test translation-unit clang-tidy, 15 fresh focused suites under ASan/TSan on both hosts and Linux MSan. All 1,380 tracked file hashes match across hosts. Full/minimalclang_releaseimages are frozen with actual ThinLTO link actions; build servers stopped before final-layout performance checks.Local Mac sanitizer checks add the selected compiler runtime directory as an absolute link rpath because an existing rg test copies the executable to test its
findinvocation. The original dyld loader failure is retained. No source, production link setting, sanitizer instrumentation or test case is changed/skipped for this diagnostic setup.Current-head CI coverage now passes: 57/57 patch lines (100%) and 40/46 patch branches (86.96%), with original 95%/85% patch floors unchanged. Release-site, pre-commit and Trunk checks also pass. The controlled final-layout and direct-parent comparisons are complete; all current-head PR CI has completed successfully, including
done.Exact final-head native confirmation
Two additional, separate populations each contain 48 cells and 5,376 output-checked calls per host: full/minimal shipping CLIs, broad/deep trees, 100/100,000 files and 1/3/10 worker budgets; one warmup plus 27 measured rounds, retaining the fastest 21. They include repeated original-image and independent ordinary file-copy controls. Images keep their original revision, SHA and link proof; no old measurement is relabeled or pooled into a new population.
The first compares final
fcf178c304with measured layout268bb2ef0f. Mac is near parity in the large three-worker cases; Linux shows 0.29%/0.76% full/minimal large-case costs and three small minimal cases with all-round paired intervals wholly slower. These observations remain retained, including the independent copy controls.The second directly compares final
fcf178c304with parent merge94e785f02f. The Linux parent executable was frozen from a verified archive snapshot of1325f0cc2fwith the identical3da8b428merge tree and 1,376 verified files; the originalsource.kindandrepresented_mergeproof remain unchanged and are included in the collector records. It is not described as a Git checkout.Large three-worker broad/deep geometric ratios (final/parent):
Every direct-parent cell and slower result is retained: Linux has 10/24 slower point estimates (maximum +1.36%), Mac 6/24 (maximum +0.86%). No direct-parent all-round paired interval is wholly slower; this does not prove zero regressions. Fastest-round point estimates and all-round paired intervals remain different estimators. Controls are displayed without post-hoc division. Both Mac RAM images were identity-verified and released; Linux's complete borrowed tmpfs fixture was verified before/after and preserved. No build, lint or archive work ran on a host during accepted timings.
Final readiness and retention
Current-head Test run 42610302444 completed successfully, including
done, every platform/sanitizer/compiler check, coverage, both expression benchmarks and the final benchmark comparison. The actual checkout was synthetic merge5318de2fbb277b6266750ac848e0a42e31d5354a; its parents are exactly base94e785f02fand headfcf178c304, and itsaab5fe6592a00c2ee0a182f4d9213d457a4d1551tree matches both locally qualified source trees. Local and remote heads independently contain current main; there are no unresolved review threads.Additional local/current-head native capsules in
/home/marcus/Documents/ondrogon.boerger.online, each SHA-256 and every manifest file verified at that destination:xff-pr1156-local-native-macos-fcf178c304-20261109.tar.gz: 39,284,988 bytes, SHA-256165ecd76395ff14c6c8c8c7e083728f206ebd4e4a58c69ac113a6e082822744c; 481 files verified.xff-pr1156-local-native-linux-fcf178c304-20261109.tar.gz: 107,194,728 bytes, SHA-256d5a09a90cbed24ee4dc0c06c923dfa883ce5c8789926c7c9ee47f8a71cd0bfad; 462 files verified.These capsules retain all source/binary/link identities, raw native populations, ordinary independent image copies, original failures, the corrected local harnesses and source bundle. They snapshot local/native qualification and earlier partial CI observations; final CI/merge evidence is retained separately. They do not reproduce a complete operating-system image or erase earlier adverse populations.