List<LibraryCycle> _collectCyclesToLoad(LibraryCycle root) {There is a specific algorithm for doing this called Tarjan's algorithm, it's implemented in package:graph here
https://github.com/dart-lang/tools/blob/main/pkgs/graphs/lib/src/strongly_connected_components.dart
I never took the time to fully understand how it works and why it's faster, but I have been very happy with its performance in build_runner :)
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Commit-Queue | +2 |
List<LibraryCycle> _collectCyclesToLoad(LibraryCycle root) {There is a specific algorithm for doing this called Tarjan's algorithm, it's implemented in package:graph here
https://github.com/dart-lang/tools/blob/main/pkgs/graphs/lib/src/strongly_connected_components.dart
I never took the time to fully understand how it works and why it's faster, but I have been very happy with its performance in build_runner :)
Yes, we already used this algorithm while building LibraryCycle(s) in `library_graph.dart`. The code here is just a simple iterative post-order traversal over already built DAG of cycles.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
AD. Collect LibraryCycle(s) to load iteratively.
Instead of loading them recursively.
This caused stack overflows in case of long (5000, 4000, 3000) chains
of importing libraries.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
List<LibraryCycle> _collectCyclesToLoad(LibraryCycle root) {Konstantin ShcheglovThere is a specific algorithm for doing this called Tarjan's algorithm, it's implemented in package:graph here
https://github.com/dart-lang/tools/blob/main/pkgs/graphs/lib/src/strongly_connected_components.dart
I never took the time to fully understand how it works and why it's faster, but I have been very happy with its performance in build_runner :)
Yes, we already used this algorithm while building LibraryCycle(s) in `library_graph.dart`. The code here is just a simple iterative post-order traversal over already built DAG of cycles.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |