[vim/vim] Avoid duplicate file checks in Windows glob (PR #21447)

5 views
Skip to first unread message

mattn

unread,
Oct 4, 2026, 10:35:59 AM (2 days ago) Oct 4
to vim/vim, Subscribed

Windows wildcard expansion checks each candidate with mch_getperm() or mch_lstat(), then calls addfile(), which repeats the same existence check. Let addfile() perform the check once, clearing EW_NOTFOUND so nonexistent literal suffixes are still rejected.

Add coverage for existing and missing literal suffixes after wildcards, including recursive patterns and expand(). This change is independent of the earlier Windows stat optimization in #21446.

Local Windows benchmarks, with the earlier stat optimization applied to both binaries, showed 22-35% shorter wildcard searches across three patterns (30 repetitions each, unchanged match counts). Five paired startup runs gave medians of 356 ms before and 349 ms after; the overall startup benefit is modest.

Validation: rebuilt this isolated commit with MinGW-w64, with no new warnings. All applicable Test_glob tests passed (5 passed, 1 Unix-only skip). test_expand.vim had 7 passes and 1 Unix-only skip with Test_source_sfile excluded: that test failed with E484 for Xresult on both pre-change and modified binaries in an earlier run. git diff --check passed.


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/21447

Commit Summary

  • bd2c146 Avoid duplicate file checks in Windows glob

File Changes

(2 files)

Patch Links:

—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/21447@github.com>

Reply all
Reply to author
Forward
0 new messages