Skip to content

Conversation

@bhearsum
Copy link
Contributor

@bhearsum bhearsum commented Aug 7, 2025

Storing this on from_deps tasks allows us to avoid iterating over potentially all the task dependencies when finding it later, which can add up to a lot of time in larger graphs.

In a profile I ran for gecko taskgraph, get_dependencies (via get_primary_dependency) was the second hottest function. With this patch it moves down to 10th place, and takes 1/4 of the amount of time it used to.

@bhearsum bhearsum added the BREAKING CHANGE Backwards incompatible request that will require major version bump label Aug 7, 2025
@bhearsum bhearsum force-pushed the push-lqokptzsytmy branch 4 times, most recently from f02dfbe to 0474896 Compare August 7, 2025 23:23
@bhearsum bhearsum marked this pull request as ready for review August 8, 2025 00:08
@bhearsum bhearsum requested a review from a team as a code owner August 8, 2025 00:08
@bhearsum bhearsum requested a review from Eijebong August 8, 2025 00:08
Copy link
Collaborator

@ahal ahal left a comment

Choose a reason for hiding this comment

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

Thanks makes sense!

I think Abhishek might also have a backwards incompatible change coming soon, so it might be worth waiting for his patch and releasing them together.

)

primary_dep = [dep for dep in group if dep.kind == primary_kind][0]
new_task["attributes"]["primary-dependency"] = primary_dep
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we anticipate issues from storing an object as an attribute rather than a string? Is there precedent for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There was precedent for it until it was removed in https://phabricator.services.mozilla.com/D193079 😆

I admit it's a bit weird. Maybe we can just store the primary dependency label, and look it up by that instead, come to think of it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that works, and is much less weird and memory consuming! It arguably makes this a non-breaking change now, too? (I guess there's other ways that primary-kind-dependency might be set other than from_deps though...)

@abhishekmadan30
Copy link
Contributor

I am not working on the duplicate dependency patch currently so it would fine to land this

@bhearsum bhearsum force-pushed the push-lqokptzsytmy branch from 0474896 to 9fee389 Compare August 8, 2025 22:37
…f a task

Storing this on `from_deps` tasks allows us to avoid iterating over potentially all the task dependencies when finding it later, which can add up to a lot of time in larger graphs.
@bhearsum bhearsum force-pushed the push-lqokptzsytmy branch from 9fee389 to baf96e2 Compare August 8, 2025 22:38
@bhearsum
Copy link
Contributor Author

bhearsum commented Aug 8, 2025

Do you want another look at this, @ahal ?

@bhearsum
Copy link
Contributor Author

Do you want another look at this, @ahal ?

I'll take silence as a no! If there's anything you'd like followed-up on, I can do so after the fact.

@bhearsum bhearsum merged commit 9b6b0c4 into taskcluster:main Aug 12, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BREAKING CHANGE Backwards incompatible request that will require major version bump

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants