这是indexloc提供的服务,不要输入任何密码
Skip to content

Avoid glob walk if there's no glob patterns #1089

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

Closed
wants to merge 1 commit into from

Conversation

Kingwl
Copy link
Contributor

@Kingwl Kingwl commented Apr 21, 2022

Fixes #720 .
Related: #1075 (comment)

I guess we can assume items in globalDeps is the specific file if there's no glob patterns.
And we just add them in the deps. (If i'm not missing some glob patterns)

@vercel
Copy link

vercel bot commented Apr 21, 2022

Someone is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

@Kingwl
Copy link
Contributor Author

Kingwl commented Apr 21, 2022

CI failed but seems not my fault.

@nathanhammond
Copy link
Contributor

This is indeed something we plan to fix, but this PR attacks the problem at the wrong level—leaking the implementation of globby into context.go We're going to pull this behavior into the globby package itself. globby should be able to optimize the amount of IO it does based upon its inputs, the call site shouldn't need to know about the globby implementation details to optimize against invoking it.

@Kingwl
Copy link
Contributor Author

Kingwl commented Apr 21, 2022

We're going to pull this behavior into the globby package itself.

Well...Is the behavior(not glob match) correct if It's in the right position?

@nathanhammond
Copy link
Contributor

I can't say for sure how it is going to be implemented since globby is about to get a full rewrite. (You can see the tests being added so that we can make sure we don't break globby over in #1090.)

Without having attempted it, my current hypothesis is that doublestar.GlobWalk will successfully optimize away the non-globbing patterns without needing to optimize the call first from application code. (We're not using GlobWalk presently, we fs.Walk and then call doublestar.PatternMatch twice.)

I'm trying to avoid introducing branches in application code if the optimizations are already in place. And, if doublestar doesn't optimize for it, it's something we may attempt to push upstream.

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

Successfully merging this pull request may close these issues.

Global dependencies always cause tree walk
2 participants