On Wednesday, June 4, 2003, at 04:01 PM, Dan Kogai wrote:
I think we should but the biggest problem on slow startup was primarily libperl.dylib (too may symbols for fix_prebinding daemon to tweak). I am now working on benchmarking the difference but even without -prebind flag the launch speed increase was significant.

And here is the benchmark.


with the new default as of 19681
% otool -hv ./perl
./perl:
Mach header
magic cputype cpusubtype filetype ncmds sizeofcmds flags
MH_MAGIC PPC ALL EXECUTE 9 1604 NOUNDEFS DYLDLINK
% redo_prebinding ./perl
redo_prebinding: file is not prebound: ./perl
% time /usr/bin/perl -le 'for (1..$ARGV[0]){system $ARGV[1], qw(-e 1)}' 1000 ./perl
2.860u 6.680s 0:12.75 74.8% 0+0k 0+4io 0pf+0w

with -Dldflags='-prebind' -Dlddflags='-bundle -undefined dynamic_lookup'
% otool -hv ./perl./perl:Mach header
magic cputype cpusubtype filetype ncmds sizeofcmds flags
MH_MAGIC PPC ALL EXECUTE 12 1884 NOUNDEFS DYLDLINK PREBOUND TWOLEVEL
% redo_prebinding ./perl
% time /usr/bin/perl -le 'for (1..$ARGV[0]){system $ARGV[1], qw(-e 1)}' 1000 ./perl
2.290u 6.490s 0:11.59 75.7% 0+0k 0+3io 0pf+0w

As you see -prebind does help though not as significant as -Uuseshrplib.


man 8 fix_prebinding
hese hints are used by the dynamic loader to launch processes prebound,
eliminating the need to look up dynamically linked symbols. If these
hints are out-of-date, the dynamic linker instead must lookup referenced
symbols. As a result, the application may launch from 10-30% slower.

So this still holds true at least for user time. Though the time saving might not be significant for ordinary users, Busy web sites with lots of CGIs should definitely benefit.


Dan the Benchmarker of Yours

P.S. Here is the comparison against our "competitors" and the script I used to benchmark. see we compare by cusr and csys, not usr and sys. Anything other than perl are pre-installed version.

#
use strict;
use Benchmark qw/:all/;
my $null = '/dev/null';
my $count = shift;
my %benches = map {  $_ => eval qq/sub{ system '$_'=>'$null' }/ } @ARGV;
my $results = timethese($count => \%benches, 'all');
# Since we are benchmarkning system, we swap (usr,sys) and (cusr,csys)
# to get a correct values for cmpthese or the value gets bogus
#  0      1      2        3               4                 5
# ($real, $user, $system, $children_user, $children_system, $iters)
for my $k (keys %$results){
    my $v = $results->{$k};
    @$v[1,2,3,4] = @$v[3,4,1,2]
 }
cmpthese($results, 'all');
__END__

Rate python ruby tclsh ./perl sh perl5.6.0
python 16.7/s -- -29% -77% -82% -85% -87%
ruby 23.6/s 41% -- -67% -74% -79% -81%
tclsh 71.4/s 327% 202% -- -23% -38% -43%
./perl 92.6/s 454% 292% 30% -- -19% -26%
sh 115/s 587% 386% 61% 24% -- -8%
perl5.6.0 125/s 647% 429% 75% 35% 9% --


We are doing great! Note ./perl is compiled with full of options like -DDEBUGGING and -Dusethreads.

P^2.S. jhi, is there an option to make (time|cmp)these to compare by cusr and csys so I don't have to tweak like the script above?



Reply via email to