Avoid compiling ignore patterns twice#190
Conversation
The ignore patterns were compiled both via picomatch's ignore option and as a standalone matcher. Compile once and apply manually in filter.
commit: |
|
i think i didn't do that initially because of some edge cases around the behavior of the negation of globstars? i'll test the pr soon (hopefully). but it's a good sign that the tests are passing 👍 |
|
@SuperchupuDev Is there anything I could help you with to land this sooner? I'm super excited for tinyglobby to get faster and consequently knip replacing fast-glob with it, shaving off 15 deps. If you could recall the edge cases, maybe I could write some extra tests for example? |
|
hi!! i've just finished some important university exams and have enough free time now to look at tinyglobby development, sorry for the wait. i'd say don't worry about it, i think i can test it myself in a day or two. the edge case i'm looking for isn't complicated i just can't remember right now exactly what it was |
SuperchupuDev
left a comment
There was a problem hiding this comment.
okay i tested a bunch and couldn't find any pattern that produces a different result than 0.2.15, so i'm merging this. will probably test some more later just in case. thank you!!
The ignore patterns were compiled both via picomatch's ignore option and as a standalone matcher. This PR makes it compile once, and apply manually in filter only.
Coming from webpro-nl/knip#1462 (comment). The change in this PR would make globbing go from >700ms to <320ms in that particular setup, because there are lots of
.gitignorefiles resulting in lots ofignorepatterns passed in totinyglobby#globSyncHere's a script to benchmark the difference:
This should show >40% improvement in time spent compared with main.
Let me know if you need anything else or how I can help with improve/benchmark this. Figured tests passing is enough for general QA?