Skip to documentation content
Branchcut
Evidence

Search performance investigation

Fresh native-tool comparisons, equal-worker controls, and source-backed bottleneck hypotheses.

What the measurements establish

Branchcut is not uniformly slower than mature file finders. Its default worker policy explains much of the broad-search loss on the tested Windows tree: Branchcut defaults to one worker, while ripgrep and fd choose multiple workers. Equal-worker runs reverse the ranking on these fixtures. No result establishes a universal fastest engine.

The initial comparison has 10,000- and 100,000-file trees, two warmups and nine samples. The thread-controlled comparison repeats the 100,000-file tree with two warmups and seven samples, adding automatic/four-worker Branchcut and one/four-worker ripgrep/fd variants. Every complete output set is checked against the generator before timing and on every sample. All tools serialize all matching relative paths to a captured pipe; none is asked to sort.

The comparisons use Windows/NTFS, ripgrep 15.1.0, fd 10.4.2, and fast-glob 3.3.3. These are fresh-process timings including startup and output, with uncontrolled filesystem caches. They are not hot-engine or cold-disk measurements. The records include raw samples, executable hashes, dirty-tree source manifests, CPU/OS/runtime details, and commands. The measured source manifests distinguish snapshots from subsequent corrections. These trees have ordinary ASCII names, no symlinks, and no ignore files; they do not establish compatibility beyond those choices. Tools use their own default case modes, which do not affect this all-lowercase fixture.

Equal-worker results

Median milliseconds; lower is better. The fixed-prefix query selects packages/p00/src/**/*.rs. The exclusion query selects Rust/TOML files outside build and dependency trees.

100,000-file workloadBranchcut 1ripgrep 1fd 1Branchcut 4ripgrep 4fd 4
All 100,000 files216.27302.81287.21104.34157.99156.07
Fixed prefix: 1,250 matches42.40202.6457.7637.19112.9559.20
Extensions/exclusions: 37,500 matches146.22218.59261.6582.40116.47119.91

For all files, the four-worker Branchcut median is about 1.51× faster than four-worker ripgrep and 1.50× faster than four-worker fd on this fixture. Broad-query P95 values are 117.06, 169.37, and 163.23 ms respectively. The default/automatic result still matters to users:

WorkloadBranchcut defaultBranchcut autoripgrep defaultfd defaultfast-glob cold
All files216.27143.60110.52112.65469.32
Fixed prefix42.4043.0585.6355.81229.80
Extensions/exclusions146.2262.2885.0399.32410.27

--threads 0 requests available parallelism capped at 16; its exact Rust-reported availability is not recorded by the CLI. This machine reports 12 logical processors. Four workers beat automatic sizing on the high-output broad query, while automatic sizing wins on the lower-output exclusion query. This is evidence against simply choosing the largest worker count for every query. It is not enough evidence to change the product default across all machines and tree shapes.

Source review

The owner explicitly requested studying competitor source. It is retained only under ignored target/perf-reference as research material; no implementation is copied into Branchcut and no third-party production dependency is introduced.

Pinned revisions:

  • ripgrep 15.1.0: af60c2de9d85e7f3d81c78601669468cf02dabab.
  • fd 10.4.2: 7027d45303b412be6fa9c09d689cc6276748fb38.
  • zlob 1.7.0: 5979979703ba21c2b47645aced50aac59ab1bca9.
ObservationEvidenceInterpretation
Default worker counts differripgrep high-level arguments, fd defaults, Branchcut cli/args.rsConfirmed source difference with a measured effect in the controlled run
Broad positive matching allocates fresh state vectorsBranchcut pattern/program.rs::advance_with_caseConcrete extra work per entry; its share of elapsed time is not yet profiler-attributed. Empty vectors with capacity zero do not heap-allocate
Count output clones a path even when it need not serialize itBranchcut cli/output.rs::matched and output_pathRemovable work in count-only workloads; cannot explain full-output results by itself
Output handoff strategies differfd batch sender, ripgrep parallel file listingfd batches results; Branchcut sends individual paths. Ripgrep also sends individual results, so a channel per path alone is not proof of the gap
Queue accounting and ignore context differripgrep walker, shared ignore contextBranchcut uses globally synchronized queue accounting and cloned rule vectors. These need contention/ignore-heavy measurements; there are no ignore files in this comparison
Matcher strategies are specialized elsewhere tooglobset compilationLiteral/basename/extension/prefix/suffix strategies and reusable scratch are useful references. Their existence is not evidence that regex or dependencies explain the observed ranking

Broad **/* queries provide little opportunity to prune: every eligible directory must be read and every returned path delivered. Branchcut's literal-root advantage matters more for scoped queries. The source identifies allocation, queue, and output costs to investigate after correcting the worker-count comparison, not a proven percentage breakdown of runtime.

Current zlob native walker reproduction

The native-walker record adds the official zlob 1.7.0 ReleaseFast library, built with Zig 0.16.0 at the pinned revision above. The separately built public-C-API probe uses zlob_walk_collect for path output and the Windows windows_ntdll backend. It requests no optional metadata, no ignores or symlink following, excludes hidden paths, and emits only regular files. Every complete path set agrees with the generator and the other tools.

These are seven-sample fresh-process medians including full output on the same 100,000-file tree. Zlob collects before output while Branchcut streams, so this does not claim equivalent memory behavior. Other native tools were rerun in the same rotation; the earlier thread-controlled record remains separate rather than being averaged into this run.

QueryBranchcut 1zlob 1Branchcut 4zlob 4Branchcut autozlob auto
All 100,000 files162.21 ms139.79 ms109.87 ms89.48 ms177.31 ms77.11 ms
Fixed prefix, 1,250 matches41.82 ms37.91 ms34.23 ms39.60 ms42.21 ms38.25 ms

Zlob wins the broad query at equal worker counts: about 1.16× at one worker and 1.23× at four. Its automatic setting is about 1.42× faster than Branchcut's best tested setting on this query. The narrow-query timings are close and do not justify a broad superiority claim. The explicit-exclusion workload is skipped for zlob because this adapter accepts one include pattern and no excludes; it must not be timed with a different result set.

The directory batches and suffix specialization are confirmed in source. This experiment still does not isolate the percentage attributable to enumeration, allocation, scheduling, or conversion. The SDK's published hot-walker figures below are a different measurement boundary, platform, and corpus; do not divide them by these CLI/probe medians.

Published landscape

These are author-published results and architecture descriptions, not independently reproduced rankings:

ProjectRelevant evidenceBoundary
zlob 1.7.0Published warm-cache 185,737-entry plain walk: 27.4 ms versus walkdir 90.9 ms; parallel ignored walk 0.64 ms versus ignore 4.9 ms. Uses native enumeration and specialized matchingPublished walker figures use best of five on another machine; CLI match and the newer parallel walker are distinct execution paths
FerralkPattern-directed parallel traversal, raw/native paths, and Git-oracle validation; published 53,601-file macOS fixture compares portable/native walkers and zlobVery close architectural comparison for Branchcut; its same-host numbers cannot be divided by our Windows CLI times
ripgrep, fdMature traversal and filename filtering; directly measured aboverg --files is a listing path, not content searching. Their content-search speed is a different workload
ugrepAuthor-maintained grep benchmarks and rich content searchingGrep/content results do not rank filename globbing
hypergrepHyperscan-based content search with SIMD/threading and published wins on selected patternsIts README comparisons include older ripgrep/ugrep releases and Linux-specific assumptions
fffRepeated search over a resident index with watcher and content-index featuresWarm indexed lookup excludes initial indexing/startup and is not an equivalent fresh filesystem query

Zlob's current source selects native scanners in walker/scan.zig: Linux batched directory reads, macOS bulk attributes when requested, and Windows directory batches carrying metadata. Its compiled_pattern.zig has specialized suffix and grouped-suffix strategies. These are credible reasons to benchmark the newer walker, not evidence that Branchcut needs unsafe code or copied platform layers.

Next experiments

Keep defaults unchanged until representative public-repository and cross-platform evidence supports an adaptive worker policy. Then measure reusable positive-state buffers, count-only path avoidance, and bounded result batches independently. Preserve first-match latency, cancellation/backpressure behavior, result equality, and losing cases. Native filesystem backends remain a later option only if measurements show the standard-library boundary dominates.

Reproduce the thread matrix after building a release executable:

node scripts/compare-current.mjs --binary target/release/branchcut.exe --oracle-dir target/oracle --sizes 100000 --warmups 2 --iterations 7 --thread-matrix --output benchmarks/results/local-thread-matrix.json

No Linux/macOS matrix is implied by these Windows tables. Public-repository measurements, a hot-process zlob/Branchcut comparison, and a zlob exclusion-capable adapter remain separate gates.

On this page