Skip to content

perf(executor): per-file glob match without staging allocs (#681) - #685

Merged
caomengxuan666 merged 1 commit into
masterfrom
perf/issue681-glob-perfile
Oct 16, 2026
Merged

caomengxuan666 merged 1 commit into
masterfrom
perf/issue681-glob-perfile

Conversation

@caomengxuan666

@caomengxuan666 caomengxuan666 commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

perf(executor): per-file glob match without staging allocs (#681)

What

Slice (a) of the glob per-file residual: glob_vector_expand built a
fresh Vec<char> per candidate file, and alt_matches_slice copied
every extglob sub-slice. GNU matches in the byte domain
(lib/glob/glob.c:641 glob_vector).

Fix

Measured (release, interleaved + GNU ref)

  • 27_glob 1000×300 *: within noise (loop+readdir dominate).
  • Matcher-heavy 2000 files×200 iters: *a*b*c* reject-all −20%;
    *f*e* accept-all −12%. Counts agree GNU/before/after.

Verification

  • New contract glob_vector_expand_scratch_reuse_matches.
  • glob_diff.sh 34/34 vs GNU; issue316_* 8/8; 08-glob-matching
    PASS under both.
  • cargo test --lib 595/595.
  • Full serial failure-set gate vs master: per-target results match.
    Test-level 3 NEW, all in the known-nondeterministic part_080
    coproc family — each green in isolation AND across 3 consecutive
    part_080 file runs on branch (whose only failure is the shared,
    order-dependent unclosed_arithmetic_subscript, identical on
    master). No regression.
  • niubash product A/B (niubash pinned 6295367, only rubash [patch]
    switched): failure sets byte-identical (49=49).

glob_vector_expand built a fresh Vec<char> per candidate; reuse one
scratch buffer per directory (same class as #281). alt_matches_slice
matches the sub-slice in place (gmatch reads name[0..len] only).
Sort untouched (slice b follow-up).

Matcher-heavy 2000 files: reject-all -20%, accept-all -12%.
Battery 34/34; lib 595/595.

GNU: lib/glob/glob.c:641 glob_vector.
@caomengxuan666
caomengxuan666 merged commit 0d556e0 into master Oct 16, 2026
8 checks passed
@caomengxuan666
caomengxuan666 deleted the perf/issue681-glob-perfile branch October 16, 2026 17:57
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