If I have two patterns like this
const files = await glob(['../app/**/*.vue', '../utilities/**/*.vue'])
and a folder structure like this
- app
- should-not-matter
- utilities
not only the app and utilities folder are searched, but also the should-not-matter folder.
This leads to huge performance breakdowns, if not only one, but many folders are »in between«.
I came to this behavior through a weird warning in Nuxt, where suddenly my build process increased from 500ms to 25seconds.
nuxt/nuxt#30137
I tracked it down to a scanDirectory function in unimport, that took longer than expected
unjs/unimport#401
I came to the conclusion that they recently switched from glob to tinyglobby
Yet glob only takes a few milliseconds, but tinyglobby takes seconds to scan everything.
Here is a reproduction.
https://github.com/fabianwohlfart/test__nuxt-layers-slowdown
You can simply go to the app folder and run the tinyglobby.mjs, you will see that it searches the folder should-not-matter, which it shouldn't.
If I have two patterns like this
and a folder structure like this
not only the app and utilities folder are searched, but also the
should-not-matterfolder.This leads to huge performance breakdowns, if not only one, but many folders are »in between«.
I came to this behavior through a weird warning in
Nuxt, where suddenly my build process increased from 500ms to 25seconds.nuxt/nuxt#30137
I tracked it down to a
scanDirectoryfunction inunimport, that took longer than expectedunjs/unimport#401
I came to the conclusion that they recently switched from
globtotinyglobbyYet
globonly takes a few milliseconds, buttinyglobbytakes seconds to scan everything.Here is a reproduction.
https://github.com/fabianwohlfart/test__nuxt-layers-slowdown
You can simply go to the app folder and run the
tinyglobby.mjs, you will see that it searches the foldershould-not-matter, which it shouldn't.