Open fabiospampinato opened 4 years ago
Do you really care about 2ms? Why?
Milliseconds add up 🤷♂️ 2ms aren't the end of the world, but it could take maybe 10ms in a low end device, and 20 of these tiny optimizations will add up to 40~200ms eventually which at startup especially will make a difference.
I can submit a PR for this if you like.
The real question here is why are you using readdirp in a browser. Eliminating it from your build would achieve the result, no?
It's a browser but it's a node.js app at the same time, i.e. I'm using Electron.
FYI picomatch was removed in https://github.com/paulmillr/readdirp/commit/703dee9f823f74fd990b503df52652f397759b1f (not released yet)
Picomatch seems to account for most of the loading time of readdirp:
I was looking into potential optimizations, and in my app I don't need to pass a glob to readdirp so still having to pay the cost for loading picomatch seems nonoptimal.
I think picomatch should be loaded lazily only if/when needed.