Discussion:
Optimising scan-libtool
Jonathan Perkin
2014-09-03 19:33:37 UTC
Permalink
For every invocation of libtool, mk/buildlink3/scan-libtool parses
each argument and runs sed on every argument which matches "-*=*" to
extract the value.

libtool is often called with e.g. "--tag=CC --mode=compile", but the
only option that is handled in scan-libtool is --mode=, so the sed
executions for --tag= are wasted.

As the only option we care about is --mode= and there are a limited
number of possible values it accepts, we don't need sed at all to
extract the optarg - we can just use shell substitution and avoid
having to fork at all.

The diff to fix this is here:

http://us-east.manta.joyent.com/pkgsrc/public/patches/scan-libtool-perf.diff

Comparisons with www/webkit1-gtk (a package with a large number of
libtool calls) at MAKE_JOBS=24 is before:

real 1:06:34.467722830
user 20:36:16.673008595
sys 1:52:04.044213746

and after:

real 1:05:50.050175590
user 20:37:21.798369207
sys 1:33:52.313198236

The real time isn't much different but there is a significant
reduction in system time, thanks to executing 170,447 fewer sed calls
over the build (observed with DTrace).
--
Jonathan Perkin - Joyent, Inc. - www.joyent.com
Loading...