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

Avoid calling depset.to_list() #484

Closed
filipesilva opened this issue Dec 27, 2018 · 0 comments · Fixed by #520
Closed

Avoid calling depset.to_list() #484

filipesilva opened this issue Dec 27, 2018 · 0 comments · Fixed by #520
Assignees

Comments

@filipesilva
Copy link
Collaborator

The Bazel performance page shows depset.to_list() as being an anti-pattern that can severely impact performance:

You can coerce a depset to a flat list using to_list(), but doing so usually results in O(N^2) cost. If at all possible, avoid any flattening of depsets except for debugging purposes.

Here we use it in a fair few places to scoop up sources: https://github.com/bazelbuild/rules_nodejs/search?q=.to_list%28%29&unscoped_q=.to_list%28%29

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 a pull request may close this issue.

3 participants