Skip to content

Conversation

@JaimeLennox
Copy link
Contributor

@JaimeLennox JaimeLennox commented Jul 25, 2021

After the change to hash all source files, we noticed a significant performance drop; generating all hashes for two different revisions took upwards of 2 minutes locally, and 6 minutes on our CI machines (which are not that powerful).

I noticed that we were looking for a target name in bazelSourceFileTargets, but this lookup was a linear one each time, and this method is called for every target we're creating a digest for. Since this set is only used here, I've changed it to a map, so we can simply lookup the target in constant time.

This is significantly faster for us, bring down the time to ~10s locally, and ~1.5mins on our CI.

This changes `bazelSourceFileTargets` from a set of targets to a map of
the target name to the target itself; that way we can simply do a lookup
of the target name, rather than looping through the set every time we
look for this (which is quite a lot, since this happens when trying to
get a digest for every single target).
Copy link
Collaborator

@tinder-maxwellelliott tinder-maxwellelliott left a comment

Choose a reason for hiding this comment

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

Thank you so much for fixing this 😊

@tinder-maxwellelliott tinder-maxwellelliott merged commit 4d56f82 into Tinder:master Jul 25, 2021
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.

2 participants