You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We should be really optimizing for compile times in dart build / flutter build, e.g. if the package graphs depth is 30 and all of them use hooks, saving a single second (e.g. via parallel compile of hooks to kernel) would save half a minute for a developer.
The initial prototype was running hooks in parallel, but it locked up someones machine (back then compiling for all targets concurrently). So maybe we should consider limiting the parallelism.
If we intend parallelism to the number of cores on the machine, then we should consider that hooks might use more than one core. Some build systems allow cooperative scheduling:
We could consider generating an all_hooks.dart wrapper script:
voidmain(List<String> args) async {
final package = args[0];
final hook = args[1];
switch((package, hook)){
case ('native_add', 'build'):return native_add_$build.main(args);
case ('native_add', 'link'):return native_add_$link.main(args);
/// ...
}
}
If we go this route, we'd want to compile all hooks in the whole package resolution (not just the dependencies of the current "run package"). Otherwise, running from a different package in the same pub workspace would cause a recompilation.
The downside would be that if there's a compilation error in a hook that's not a dependency, it prevents running things in the workspace.
The assumption here is that many hooks will share the majority of the code. E.g. the standard libraries, the native_assets_cli and possibly other helper packages. It might be that the speedup would be worth it, we'd need to measure.
We should consider:
Originally posted by @mkustermann in #1256 (comment)
The initial prototype was running hooks in parallel, but it locked up someones machine (back then compiling for all targets concurrently). So maybe we should consider limiting the parallelism.
If we intend parallelism to the number of cores on the machine, then we should consider that hooks might use more than one core. Some build systems allow cooperative scheduling:
More conservatively, we could consider only compiling hooks in parallel.
The text was updated successfully, but these errors were encountered: