runtime: improve ICDs binding speed
Instead of repeatedly calling "capsule-capture-libs" we can combine all the libraries that we need with the same destination directory, greatly reducing the number of processes that needs to be spawn.
/cc @smcv
While working on another task I noticed that the whole binding of ICDs was taking about 1-1.5 seconds to complete, probably due to the fact that every ICDs are taken using a separate process call to capsule-capture-libs
, prefixed by bwrap
.
I sketched an implementation that groups together, based on their destination dir, all the ICDs that we want to bind. In this way we can call capsule-capture-libs
just a few times (from ~100 times, down to ~10 times).
The performance gain is not as much as I expected, but still it reduces the whole ICDs binding time in half.
This MR is not in a mergeable state yet, because before investing more time on it is probably better to gather some feedback on this approach and maybe even wait the partial rewrite of pressure-vessel, to support the sub-sandboxing of Flatpak, to land first.