Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Very slow in a directory with nested directories and one-level pattern #45

Open
mrmlnc opened this issue May 22, 2019 · 2 comments
Open
Labels
enhancement New feature or request

Comments

@mrmlnc
Copy link
Contributor

mrmlnc commented May 22, 2019

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.

@mrmlnc mrmlnc changed the title Very slow in a directory with nested directories Very slow in a directory with nested directories and one-level pattern May 22, 2019
@lukeed
Copy link
Collaborator

lukeed commented May 22, 2019

Hey, thanks~!

If I understand correctly, you're saying that directory/* is behaving like directory/**, right? If so, yes, that definitely should be fixed

@mrmlnc
Copy link
Contributor Author

mrmlnc commented May 22, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants