fs: implement glob natively - #65392
Conversation
|
Review requested:
|
|
cc @isaacs @nodejs/fs |
f172fce to
8bedc81
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #65392 +/- ##
==========================================
- Coverage 90.17% 89.98% -0.19%
==========================================
Files 771 784 +13
Lines 265172 268265 +3093
Branches 50364 51099 +735
==========================================
+ Hits 239119 241411 +2292
- Misses 17010 17409 +399
- Partials 9043 9445 +402
🚀 New features to boost your workflow:
|
I would feel more comfortable adopting one of those instead of having to maintain our own, have you explored that route? |
I have, but the perf wins here are dependent on this being in native, and not in JS:
I also think this can bring some improvements to things like the test runner. For instance, |
8bedc81 to
55e4ca3
Compare
|
(Whoops!) |
|
Here's the results of Notes:
Given the deep cuts made here, I'd expect to see the native implementation get at least 5 to 10 times faster than node-glob. No longer being 6x slower is indeed a significant improvement, perhaps enough to make it worth landing this as-is and making further improvements later. But it's definitely still not what I'd call "done", by quite a bit. |
fd617c2 to
77675d2
Compare
It's not what I meant though, my question is whether you explored adopting one of the native alternatives your AI based itself on (you mentioned Rust, surely that is not JS) |
https://github.com/oxc-project/fast-glob, the Rust implementation I mentioned, isn't compliant with minimatch (e.g. negated patterns don't work). A lot of the really fast implementations aren't compatible with our current set up (as they match different globs). As @isaacs said about a different |
c7f32c9 to
721c2e2
Compare
|
Minimatch had its own tests that covered it extensively. Those tests have not been ported over to this codebase, which I think should be to guarantee backward-compatibility and no regressions. |
|
cc @nodejs/build, |
fbbb04c to
ca1176d
Compare
ca1176d to
6ff6ff1
Compare
This comment was marked as outdated.
This comment was marked as outdated.
6ff6ff1 to
ba3353a
Compare
This comment was marked as outdated.
This comment was marked as outdated.
gurgunday
left a comment
There was a problem hiding this comment.
Nice work! I've been playing with the implementation this morning and it lgtm overall
I just have one question/concern
Signed-off-by: avivkeller <me@aviv.sh>
ba3353a to
7e08680
Compare
|
hello, unsolicited review here ;) IMO, I think that it is only reasonable for us to But if it is intended that way that it needs to have granted access to the parent directory, I think it would be helpful for us to clarify it in the documentation |
Signed-off-by: avivkeller <me@aviv.sh> PR-URL: #65392 Refs: https://openjs-foundation.slack.com/archives/C019Y2T6STH/p1787069174254509 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
|
Landed in a8f2bf0 |
Ref: https://openjs-foundation.slack.com/archives/C019Y2T6STH/p1787069174254509
(AI assistance used to help port minimatch to C++ and take improvements from other implementations, e.g. Rust's fast-glob [oxc] and picomatch, etc).
I'd love some pretty pedantic reviews since this is substantial. It's 1:1 with the existing glob, so it's non-breaking, but please tear this apart just in case. This implementation is over 2x faster than the old one.
Benchmarking Result
AI-Assisted-By: Claude Fable 5, Claude Opus 5