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

module searching is VERY slow for me #100

Closed
bdwain opened this issue Jul 12, 2018 · 6 comments
Closed

module searching is VERY slow for me #100

bdwain opened this issue Jul 12, 2018 · 6 comments

Comments

@bdwain
Copy link

bdwain commented Jul 12, 2018

I'm seeing issues with the way path searching works that make it VERY slow. If i say yo foo, it takes about 30 seconds to get to the first prompt. It seems like I should be able to do something to make it faster. I'll try to explain my setup.

I have a generator called generator-foo and I am currently moving it to my monorepo called foo. Both the old generator-foo folder and the new foo folder (the monorepo) are at /Users/bwain/dev. The new generator that lives in the monorepo is at /Users/bwain/dev/foo/generator-foo. The way I call the generator is to say yo foo from a package.json script at the root of the monorepo. It doesn't globally install the generator or yo or anything.

I've noticed that the slowness is when searching paths (in findGeneratorsIn). One of the main ones it spends a lot of time on is /Users/bwain/dev, which has a lot of projects in it. I don't see why it should be searched though, because that's out of my project completely.

The issues seems to be this line https://github.com/yeoman/environment/blob/master/lib/resolver.js#L140

Commenting it out sped up the generator start time from 30 seconds to 6. I don't think the location of my projects folder should matter though. If anything, the search should bail out early as soon as it finds a valid generator, assuming it searches in priority order.

@SBoudrias
Copy link
Member

If anything, the search should bail out early as soon as it finds a valid generator, assuming it searches in priority order.

Would you be interested to work on this? I think this would be an awesome improvement, but a little complicated.

Right now when you run yo foo, it's unlikely it'll run a single generator. A lot of generators out there will rely on other generators and compose with them (composeWith.)

So we'd need to bail on first find, but keep the search available so we don't waste time when starting to search for another one.

@bdwain
Copy link
Author

bdwain commented Jul 30, 2018

Ah I see. I can try to look at some point, but I probably won't have time for a while. Thanks for clarifying though!

@SBoudrias
Copy link
Member

BTW the main issue is discussed over here, and looks like I figured out the root cause. I'll push a fix soon.

We still could optimize the yeoman-environment logic itself like discussed earlier.

@mshima
Copy link
Member

mshima commented Dec 20, 2019

This bug should be fixed with #127
Using filterPaths option.

@mshima
Copy link
Member

mshima commented Dec 20, 2019

Maybe this option should be enabled by default.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2020

This issue is stale because it has been open 15 days with no activity. Remove stale label or comment or this will be closed in 5 days

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants