Post

After four months in the making, tinyglobby 0.2.11 is out! This release adds important optimizations to avoid crawling extra directories, which should greatly improve performance in almost all cases! Here's how we did it 🧵 github.com/SuperchupuDe...

github.comRelease 0.2.11 · SuperchupuDev/tinyglobbyI've opened a sponsorships page! Consider sponsoring at https://github.com/sponsors/SuperchupuDev if you'd like to support the development of this project. This is a huge release in a technical asp...

While the last tinyglobby release had some optimizations in place, there were some cases in which the library could crawl the whole cwd(!). For big projects, this wasn't ideal, due to the sheer size of the node_modules folder.

Four months ago, I opened an issue detailing some aspects of how a good optimizer could look like. With the help of some friend of mine, we managed to come up with an implementation that generated extra patterns for each pattern to try and resemble the matching behavior needed

0 reposts5 likes

It wasn't too optimal, but it was definitely better than crawling extra dirs. After further investigating and with some help, we came up with an implementation that modified the patterns inside the optimizer to know exactly what to crawl

However it turned out that pattern modification could break some odd (yet valid!) patterns! After three months of research without much progress, I discovered that the functionality we wanted wasn't unheard of. It turned out minimatch already had it! But we didn't use that to stay with fewer deps

So the problem wasn't solved just yet. I still had to manually implement what we wanted. But it was a step in the right direction! After another round of research and looking into how other matching libraries work, I came up with the implementation we needed: a performant, partial glob matcher

This last implementation is not just more performant, but it's also way more predictable. In tests, the library performed way more consistent!! This couldn't have been done without the help and advice of @e18e.dev members and many others. I'm so grateful that so many people care about performance ❤️