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

perf: avoid unnecessary nested depset() #1435

Merged
merged 2 commits into from
Dec 16, 2019

Conversation

jbedard
Copy link
Collaborator

@jbedard jbedard commented Dec 10, 2019

As described in the bazel docs unnecessarily nesting depsets is a performance anti-pattern.

I think all these cases are pretty basic changes?

Copy link
Collaborator

@alexeagle alexeagle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes I've seen Bazel team sending such changes, they have some new static checking for this anti-pattern? Thanks!


return [
DefaultInfo(
executable = executable,
runfiles = ctx.runfiles(
transitive_files = runfiles,
transitive_files = depset(runfiles_depsets),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the fact that you don't use transitive = runfiles_depsets makes me think the variable is misnamed, and runfiles_depsets is actually just runfiles list

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I guess it is just plain files, previously those plain files were converted into transitive depsets though. I think this change is ok though, but the var should be renamed...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to just runfiles

@jbedard jbedard force-pushed the bazel-perf branch 2 times, most recently from 7c1c888 to c685e73 Compare December 10, 2019 19:09
sources_sets = []
# Also avoid deap transitive depset()s by creating single array of
# transitive depset()s
sources_depsets = []
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a rename after rebasing. Revert?

@jbedard
Copy link
Collaborator Author

jbedard commented Dec 10, 2019

Updated. I think the buildkite failure is random?

@jbedard
Copy link
Collaborator Author

jbedard commented Dec 11, 2019

Or maybe it isn't random? I don't see how that could be related though...

@jbedard
Copy link
Collaborator Author

jbedard commented Dec 14, 2019

@alexeagle the build failure seems to be the same thing as PRs such as #1445 - so I guess it is random and unrelated to this change?

@alexeagle
Copy link
Collaborator

Yes that test is terribly flaky right now, in that it sometimes but rarely passes. We need to jump on that this week.

@alexeagle alexeagle merged commit f386322 into bazel-contrib:master Dec 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants