tiny-glob
tiny-glob copied to clipboard
Very slow in a directory with nested directories and one-level pattern
Versions
- Windows 10 (17763)
- NVMe (Samsung MZVLB512HAJQ)
- Node.js 12.0.0
A directory tree
directory
- file.txt
- node_modules
Reproduce steps
const tg = require('tiny-glob/sync');
console.time('tiny-glob');
const entries = tg('directory/*');
console.timeEnd('tiny-glob');
console.dir(entries, { colors: true });
Current behaviour
The walk
function is called for each directory inside the root directory. And it takes 256ms.
Expected behaviour
One the walk
function call. And… it takes around 2-5ms.
Hey, thanks~!
If I understand correctly, you're saying that directory/*
is behaving like directory/**
, right? If so, yes, that definitely should be fixed
Probably not. With directory/*
pattern result is correctly (only files from the first level of the directory
directory), but inside we read all the subdirectories (like with dirrctory/**
pattern).
Looks like edge case. With directory/*.json
pattern works correctly.