tidy/strip: Make strip and collecting of debug symbols in parallel
It's not as fast implementation as !175 (closed), but unlike that it runs on pure Bash, which I hope is free from any portability issues, and by all my tests it works quite correctly and provides the same behavior as before (although additional testing is certainly welcome). On my CPU with 16 threads it gives about 2x speedup on average.
This could definitely be made much faster if we could know the exact number of processes in flight, and could be feasible with wait -n
, but requires introducing some synchronization methods, because all my experiments show that there is a race condition with wait -n
. But I think that would be too heavy for this script so far, so I propose to settle on this implementation until we find something better, as it at least gives some stable speed gain.