| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Review requested:
|
Sorry, something went wrong.
Codecov Report❌ Patch coverage is 76.20199% with 886 lines in your changes missing coverage. Please review. @@ Coverage Diff @@
## main #65392 +/- ##
==========================================
- Coverage 90.14% 89.92% -0.22%
==========================================
Files 751 764 +13
Lines 253635 256475 +2840
Branches 47793 48440 +647
==========================================
+ Hits 228632 230636 +2004
- Misses 16249 16706 +457
- Partials 8754 9133 +379
... and 37 files with indirect coverage changes 🚀 New features to boost your workflow:
|
Sorry, something went wrong.
I would feel more comfortable adopting one of those instead of having to maintain our own, have you explored that route? |
Sorry, something went wrong.
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, --test-coverage-include/exclude is globbed on the native side (like a supercharged version of #65371), we should be able to bring this performance improvement elsewhere. Maybe this can help in similar ways in other places to? |
Sorry, something went wrong.
|
(Whoops!) |
Sorry, something went wrong.
|
Here's the results of node-glob's benchmark script with this branch, as of fd617c2: https://gist.github.com/isaacs/abf2714edd59cb6803d36ff6b3407d22 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. |
Sorry, something went wrong.
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) |
Sorry, something went wrong.
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 fast-glob (a different library of the same name), "these implementations sacrifice correctness for speed, and thus are not apples-to-apples comparable." That can be said about several implementations, so working from scratch was the best way to both match the existing behavior and take the performance benefits from the existing implementations. |
Sorry, something went wrong.
There was a problem hiding this comment.
lgtm
Sorry, something went wrong.
|
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. |
Sorry, something went wrong.
| paths.reserve(entries.size()); | ||
| for (const WalkEntry& entry : entries) { | ||
| Local<Value> path; | ||
| if (!ToV8Value(context, entry.path, isolate).ToLocal(&path)) { |
There was a problem hiding this comment.
Hmm... we really ought to make sure that things work with non-UTF8 characters in the file path. Not necessarily critical for this version as long as it matches what the js version does, but we should check on it.
Sorry, something went wrong.
|
Minimatch also had documentation for the glob syntax that does not appear to be preserved. The source itself could use code comments and a description of the glob syntax and rules. |
Sorry, something went wrong.
|
I plan on taking an additional detailed review pass on this over the next day or two. I know you have two sign offs already. I'd appreciate if you let it sit for a few days for review before landing. |
Sorry, something went wrong.
|
Of course! |
Sorry, something went wrong.
| const CompileFlags& flags) { | ||
| std::vector<PatternString> matched; | ||
| for (size_t i = 0; i + 1 < glob_parts->size(); i++) { | ||
| for (size_t j = i + 1; j < glob_parts->size(); j++) { |
There was a problem hiding this comment.
The double nesting here is rather awkward. Might be worthwhile splitting these out into two separate functions.
Sorry, something went wrong.
|
ok, handful of additional comments. Main issue is that test coverage needs to be expanded. couple of bugs but overall solid. |
Sorry, something went wrong.
|
Breaking change since a string that contains every unicode character will now throw an error (that being said, this should never occur in pretty much any case). But, it's still a change. |
Sorry, something went wrong.
I ported fd43e85#diff-52af056e4dffb90208b74c52cfa8646e6bd486b73ddf0c71c907e1fdc52c0a51 from minimatch, and everything passes |
Sorry, something went wrong.
Sorry, something went wrong.
|
Does our CI still not like merges (should I rebase this?), or have things changed in the recent past? |
Sorry, something went wrong.
Signed-off-by: avivkeller <me@aviv.sh>
|
@avivkeller ... always rebase, never merge. |
Sorry, something went wrong.
| failed_ = true; | ||
| return false; |
There was a problem hiding this comment.
The typical pattern here would be to return a v8::Maybe<bool>. When ToLocal return false, you'd return a v8::Nothing<bool>() signaling the failure. Otherwise return a v8::Just(true|false).
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
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 Resultconfidence improvement accuracy (*) (**) (***) fs/bench-glob-options.js options='exclude-callback' mode='callback' pattern='**/*.js' dir='lib' n=1000 *** 115.93 % ±19.24% ±26.59% ±36.73% fs/bench-glob-options.js options='exclude-callback' mode='promise' pattern='**/*.js' dir='lib' n=1000 *** 115.54 % ±20.02% ±27.26% ±36.78% fs/bench-glob-options.js options='exclude-callback' mode='sync' pattern='**/*.js' dir='lib' n=1000 *** 69.66 % ±14.00% ±18.97% ±25.42% fs/bench-glob-options.js options='exclude-pattern' mode='callback' pattern='**/*.js' dir='lib' n=1000 *** 37.86 % ±12.27% ±16.90% ±23.19% fs/bench-glob-options.js options='exclude-pattern' mode='promise' pattern='**/*.js' dir='lib' n=1000 *** 41.06 % ±11.48% ±15.49% ±20.60% fs/bench-glob-options.js options='exclude-pattern' mode='sync' pattern='**/*.js' dir='lib' n=1000 3.81 % ±11.93% ±16.14% ±21.56% fs/bench-glob-options.js options='none' mode='callback' pattern='**/*.js' dir='lib' n=1000 *** 153.86 % ±20.91% ±28.39% ±38.12% fs/bench-glob-options.js options='none' mode='promise' pattern='**/*.js' dir='lib' n=1000 *** 150.49 % ±18.20% ±24.64% ±32.95% fs/bench-glob-options.js options='none' mode='sync' pattern='**/*.js' dir='lib' n=1000 *** 98.16 % ±11.23% ±15.15% ±20.14% fs/bench-glob-options.js options='withFileTypes' mode='callback' pattern='**/*.js' dir='lib' n=1000 *** 111.98 % ±19.57% ±26.99% ±37.14% fs/bench-glob-options.js options='withFileTypes' mode='promise' pattern='**/*.js' dir='lib' n=1000 *** 111.56 % ±17.41% ±23.58% ±31.53% fs/bench-glob-options.js options='withFileTypes' mode='sync' pattern='**/*.js' dir='lib' n=1000 *** 76.30 % ±15.82% ±21.46% ±28.80% fs/bench-glob.js mode='callback' pattern='*.js' dir='lib' n=1000 *** 64.04 % ±6.85% ±9.31% ±12.51% fs/bench-glob.js mode='callback' pattern='**/*.{js,json}' dir='lib' n=1000 *** 181.99 % ±5.73% ±7.78% ±10.46% fs/bench-glob.js mode='callback' pattern='**/*.js' dir='lib' n=1000 *** 162.05 % ±7.08% ±9.77% ±13.47% fs/bench-glob.js mode='callback' pattern='**/*' dir='lib' n=1000 *** 167.88 % ±9.26% ±12.60% ±16.98% fs/bench-glob.js mode='promise' pattern='*.js' dir='lib' n=1000 *** 46.39 % ±2.77% ±3.78% ±5.12% fs/bench-glob.js mode='promise' pattern='**/*.{js,json}' dir='lib' n=1000 *** 167.71 % ±7.07% ±9.74% ±13.39% fs/bench-glob.js mode='promise' pattern='**/*.js' dir='lib' n=1000 *** 158.22 % ±13.81% ±19.17% ±26.64% fs/bench-glob.js mode='promise' pattern='**/*' dir='lib' n=1000 *** 156.03 % ±11.17% ±15.48% ±21.47% fs/bench-glob.js mode='sync' pattern='*.js' dir='lib' n=1000 *** 29.58 % ±4.99% ±6.92% ±9.59% fs/bench-glob.js mode='sync' pattern='**/*.{js,json}' dir='lib' n=1000 *** 112.35 % ±6.09% ±8.24% ±11.01% fs/bench-glob.js mode='sync' pattern='**/*.js' dir='lib' n=1000 *** 93.18 % ±5.53% ±7.60% ±10.38% fs/bench-glob.js mode='sync' pattern='**/*' dir='lib' n=1000 *** 85.16 % ±13.12% ±18.20% ±25.31% Be aware that when doing many comparisons the risk of a false-positive result increases. In this case, there are 24 comparisons, you can thus expect the following amount of false-positive results: 1.20 false positives, when considering a 5% risk acceptance (*, **, ***), 0.24 false positives, when considering a 1% risk acceptance (**, ***), 0.02 false positives, when considering a 0.1% risk acceptance (***)AI-Assisted-By: Claude Fable 5, Claude Opus 5