![]() |
|
There's more than one way to do things | |
PerlMonks |
perlbenching 5.8.0 (was: relative speed of 5.8.0)by danger (Priest) |
on Jul 24, 2002 at 00:22 UTC ( #184652=note: print w/replies, xml ) | Need Help?? |
I compiled threaded and non-threaded versions of 5.8.0 today and I timed the wc.pl script shown above on a largish file using both 5.8.0's and my earlier 5.6.1. The threaded-5.8.0 was in the neighborhood 50% slower than the 5.6.1 release --- the unthreaded-5.8.0 was about 20% slower. So I decided to run perlbench to compare these three perls and try to pinpoint the problem. Follow the readmore tag for discussion and results ... The standard perlbench tests did not uncover a cause: Overall 5.8.0 with threads performed about 15% slower than 5.6.1. The only serious areas of slowdown (see below) were for startup costs --- but since that cost is amortized over the runtime of the wc.script, it wouldn't account for the large spread. So I added another directory of tests (xtra/) to test length and split (and open and join) to see if they were the cuplrits (since basic arithmetic had been tested and though the threaded result wasn't pretty, it couldn't account for a 50% relative difference). The length test showed no big surprise, and while the open is very much slower in 5.8.0 (moreso in the threaded version), it is hardly a factor as only one file was opened when I tested the wc.pl script. (Note: both 5.8.0's were compiled with perlio support, and 5.6.1 was not). Notable, however, is the result for split --- a *very* sizable slowdown for 5.8.0-threaded, and the causative factor of the greater than expected slowdown. Replacing the split call in wc.pl with a constant array and I only saw a 5% difference between 5.6.1 and 5.8.0-threaded --- which is somewhat less of a difference than I might have predicted after viewing the perlbench results. Someone else might review the 5.8.0 source to see what happened to split and if anything can be done to improve the performance of such an oft-used routine --- as for me, now that I've got two shiny new 5.8.0's, I'm off to CPAN to start fetching packages ...
The code used to test split is as follows (stored in "t/xtra/split.t" under perlbench):
In Section
Meditations
|
|