-
-
Notifications
You must be signed in to change notification settings - Fork 636
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
Improve performance of TransitiveTargets
/CoarsenedTargets
#11270
Comments
#11202 introduced a lot of contention on the GIL that was only obvious when larger numbers of targets were being built. #11270 is a holistic fix for that issue, but it is currently blocked on #11269. In the meantime, we will land #11271 to dodge the original issue in #11201 to get us back to a medium-slow-but-working state, and then follow up on #11269 and #11270 to get us to the best place. This reverts commit fabcb45. [ci skip-build-wheels]
…sbuild#11272) In the meantime, we will land pantsbuild#11271 to dodge the original issue in pantsbuild#11201 to get us back to a medium-slow-but-working state, and then follow up on pantsbuild#11269 and pantsbuild#11270 to get us to the best place. This reverts commit fabcb45. [ci skip-build-wheels]
…sbuild#11272) In the meantime, we will land pantsbuild#11271 to dodge the original issue in pantsbuild#11201 to get us back to a medium-slow-but-working state, and then follow up on pantsbuild#11269 and pantsbuild#11270 to get us to the best place. This reverts commit fabcb45. [ci skip-build-wheels]
…sbuild#11272) In the meantime, we will land pantsbuild#11271 to dodge the original issue in pantsbuild#11201 to get us back to a medium-slow-but-working state, and then follow up on pantsbuild#11269 and pantsbuild#11270 to get us to the best place. This reverts commit fabcb45. [ci skip-build-wheels]
…sbuild#11272) In the meantime, we will land pantsbuild#11271 to dodge the original issue in pantsbuild#11201 to get us back to a medium-slow-but-working state, and then follow up on pantsbuild#11269 and pantsbuild#11270 to get us to the best place. This reverts commit fabcb45. [ci skip-build-wheels]
…11272) (#11277) #11202 introduced a lot of contention on the GIL that was only obvious when larger numbers of targets were being built. #11270 is a holistic fix for that issue, but it is currently blocked on #11269. In the meantime, we will land #11271 to dodge the original issue in #11201 to get us back to a medium-slow-but-working state, and then follow up on #11269 and #11270 to get us to the best place. This reverts commit fabcb45. [ci skip-build-wheels]
…11272) (#11275) #11202 introduced a lot of contention on the GIL that was only obvious when larger numbers of targets were being built. #11270 is a holistic fix for that issue, but it is currently blocked on #11269. In the meantime, we will land #11271 to dodge the original issue in #11201 to get us back to a medium-slow-but-working state, and then follow up on #11269 and #11270 to get us to the best place. This reverts commit fabcb45. [ci skip-build-wheels]
I believe that rather than necessarily internally structure-sharing for multiple distinct Rather than making a |
How hard would that be to do? I suspect it will make a tangible impact on Pylint and MyPy -- the dedicated rule for partitioning seems to take at ~1 second on my very fast M1 in a not very huge repository.. |
Not too hard? I suspect that the biggest challenge will be updating all of the relevant callsites to avoid making lots of requests in parallel. But that could be incremental, since |
`CoarsenedTarget`s are structure shared, and because they preserve their internal structure, they can service requests for transitive targets for different roots from the same datastructure. Concretely: Mypy and Pylint can consume `CoarsenedTargets` to execute a single `@rule`-level graph walk, and then compute per-root closures from the resulting `CoarsenedTarget` instances. This does not address #11270 in a general way (and it punts on #15241, which means that we still need per-root transitive walks), but it might provide a prototypical way to solve that problem on a case-by-case basis. Performance wise, this moves cold `check ::` for ~1k files from: * `main`: 32s total, and 26s spent in partitioning * `branch`: 19s total, and 13s spent in partitioning The rest of the time is wrapped up in #15241.
…d#15141) `CoarsenedTarget`s are structure shared, and because they preserve their internal structure, they can service requests for transitive targets for different roots from the same datastructure. Concretely: Mypy and Pylint can consume `CoarsenedTargets` to execute a single `@rule`-level graph walk, and then compute per-root closures from the resulting `CoarsenedTarget` instances. This does not address pantsbuild#11270 in a general way (and it punts on pantsbuild#15241, which means that we still need per-root transitive walks), but it might provide a prototypical way to solve that problem on a case-by-case basis. Performance wise, this moves cold `check ::` for ~1k files from: * `main`: 32s total, and 26s spent in partitioning * `branch`: 19s total, and 13s spent in partitioning The rest of the time is wrapped up in pantsbuild#15241. # Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels]
…ck of #15141) (#15244) `CoarsenedTarget`s are structure shared, and because they preserve their internal structure, they can service requests for transitive targets for different roots from the same datastructure. Concretely: Mypy and Pylint can consume `CoarsenedTargets` to execute a single `@rule`-level graph walk, and then compute per-root closures from the resulting `CoarsenedTarget` instances. This does not address #11270 in a general way (and it punts on #15241, which means that we still need per-root transitive walks), but it might provide a prototypical way to solve that problem on a case-by-case basis. Performance wise, this moves cold `check ::` for ~1k files from: * `main`: 32s total, and 26s spent in partitioning * `branch`: 19s total, and 13s spent in partitioning The rest of the time is wrapped up in #15241.
TransitiveTargets
/CoarsenedTargets
Going to revisit this one. #15141 fully fixed I'm going to spend a little bit of time thinking through whether there is a holistic solution to avoid needing to change APIs. But in the absence of that, adjusting both the |
TransitiveTargets
/CoarsenedTargets
TransitiveTargets
/CoarsenedTargets
I gave this one some thought last week, and came to the conclusion that while structure sharing is still helpful, recursive memoization is just not feasible in the presence of graph cycles. Which is part of why when we added support for cycles, we did so by moving But iteration is also memoizable: usually via a map/dict on the stack of your iteration function. Unlike recursion though, it isn't referentially transparent, and so requires (visible) mutability. So: I think that by adding a new feature to the Supporting mutable state in the |
When #10409 introduced cycle tolerance, it also removed structure sharing of
TransitiveTarget
instances. This meant that if you made 100TransitiveTargets
requests, much less of their work could be reused, and in particular, cycle detection could not be reused. Cycle detection is cheap enough to do for one concurrent instance, but not to do hundreds of times redundantly.The text was updated successfully, but these errors were encountered: