-
-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use minimatch to handle negative globs, fixes #2; Run positive globs in parallel, fixes #3 #6
Conversation
…in parallel, fixes #3; Negative globs handling is over 2.5x faster now in regards to my previous benchmark.
Here's a diagram of the control flow this PR implements: @sindresorhus PTAL when you have time. |
c35f7db
to
4c4a126
Compare
(moved benchmarking to #10) Benchmarks before this PR: Benchmarks after this PR: Looks like the negative glob perf improvement is not visible in this benchmark because all the negated files are in the same directory, which is far less consuming than walking deeply nested directories (as |
The benchmarks above were using 100 negated files. It looks like the minimatch approach is only faster when there are > 500 negated files (my initial test before proposing this PR was using 11,000 negated files). |
@sindresorhus do you want to do some review (code style validation, etc.) or should I just merge? |
Sorry for the spam of screenshots, the only important one is the latest one, the rest are outdated. |
🎆 And happy NYE! 🎆 |
Wonder if there's more opportunities for perf improvements. Probably not, but the bench makes it a lot easier to explore, thanks for that :) |
Weird. I'm seeing different results for
The sync version seems more stable though. |
@sindresorhus Happy new year to you too.
That's odd indeed. Did you update the
Ah, and last time I checked, npm had a caching issue -- when pulling from a GitHub repo, it would cache the repository's package.json version as if it was the real version release, then next time |
Oh, I just found one more small optimization we can make (see gulpjs/glob-stream#33), but it shouldn't matter much. I'll push it to globby later if it doesn't make the code too ugly. I believe the next big optimization would be to use node-glob's As for benchmarking, I'll open an issue to discuss some possible improvements. |
Yes, ofc. npm caches branches so you kinda have to do it.
That will help a lot! :) Seeing how Isaac don't want to support multiple patterns natively it seems that this module will have to stay. |
Oh I'm also running into the same perf diff issue, looks like the first bench is up to 10% slower for some reason. If I add another benchmark test before the actual benchmarks then it evens out the difference a bit:
|
I fiddled a bit with benchmark.js, and according to it, upstream/master is 10% slower hahah. |
@UltCombo hmm, maybe it has something to do with the filesystem/harddrive cache. |
That's the most likely yeah, seeing as filesystem access is the biggest bottleneck here. |
Fixes #2
Fixes #3
Negative globs handling is over 2.5x faster now in regards to my previous benchmark.