native icon indicating copy to clipboard operation
native copied to clipboard

[native_assets_builder] Compile and run hooks in parallel

Open dcharkes opened this issue 1 year ago • 0 comments

We should consider:

  • compiling hooks in parallel
  • running hooks in parallel

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.

Originally posted by @mkustermann in https://github.com/dart-lang/native/issues/1256#issuecomment-2213676077

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:

  • https://www.gnu.org/software/make/manual/html_node/Job-Slots.html
  • https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-build-scripts

More conservatively, we could consider only compiling hooks in parallel.

dcharkes avatar Jul 10 '24 14:07 dcharkes