Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Re: relative speed of 5.8.0

by Anonymous Monk
on Jul 22, 2002 at 18:51 UTC ( [id://184176]=note: print w/replies, xml ) Need Help??


in reply to Re: relative speed of 5.8.0
in thread relative speed of 5.8.0

I recall hearing things like a 15% slowdown for using threads and nothing close to 50% as well. Here is the simple wc.pl script used and timings for 5.6.1(no-threads) and 5.8.0(threaded).
############ # here's a real wc on the data.txt file $ wc data.txt 208048 1675832 11021496 data.txt ############ # here's the test wc.pl script $ cat wc.pl #!/usr/bin/perl -w use strict; my $total = @ARGV > 1; my($lines, $words, $bytes); while(<>){ my @words = split; $words += @words; $bytes += length; $lines++; } printf "%7d %7d %7d %s\n",$lines,$words,$bytes,$ARGV; ############ # here's results for 5.6.1 no-threads in /usr/bin/perl $ /usr/bin/perl -v This is perl, v5.6.1 built for i686-linux $ time /usr/bin/perl wc.pl data.txt 208048 1675832 11021496 data.txt real 0m7.220s user 0m7.030s sys 0m0.080s ############ # here's results for 5.8.0 threaded in /usr/local/bin/perl $ /usr/local/bin/perl -v This is perl, v5.8.0 built for i686-linux-thread-multi $ time /usr/local/bin/perl wc.pl data.txt 208048 1675832 11021496 data.txt real 0m15.591s user 0m15.350s sys 0m0.130s

For 5.8.0 non-threaded but with 64-bit integer support the above ran at 9.2 seconds (circa 20% slower).

Replies are listed 'Best First'.
Re: Re: Re: relative speed of 5.8.0
by Elian (Parson) on Jul 22, 2002 at 20:27 UTC
    Be careful mixing times for 32-bit perls and 64-bit perls, especially on systems that emulate 64-bit integers, like gcc/libc on the x86 systems do. There's a lot of extra overhead there and, while the ultimate numbers are slower, you're not comparing apples to apples. Even native 64-bit systems like the alphas may perform more slowly, since you're slinging more data across the bus and using more cache memory for each variable.
Re: Re: Re: relative speed of 5.8.0
by Hrunting (Pilgrim) on Jul 23, 2002 at 12:45 UTC
    Use a benchmark utility like Benchmark.pm to get your figures. Using time on a Unix system is notoriously inaccurate for measuring differences in perl. I have no doubt that 5.8 is slower (it is, after all, doing more work with Unicode and all), but 50% sounds too horrendous for any developer to accept. My bet is that by using time, you're also counting the startup time for perl, which is probably significant considering how much more has been built into it. For those small 7-15 second jobs, it might take 1.5-2 seconds for perl to startup and compile everything it needs to.
      When you want to measure timing differences between two different perl interpreters you want to use an independent timing facility. The time program works perfectly well for this task (and my system was under very low load, and I repeated the timings several times with consistent results). Yes my timings also measure startup costs, but that is insignificant as an absolute factor and even less significant as a relative factor. Just to ease your mind vis-a-vis startup costs, the times to fire up each interpreter with strict and -w are roughly 0.011 and 0.015 seconds respectively. These times are almost certainly in the realm of measurement error and we should only use them as a basis to conclude that startup costs are an insignificant factor in the 8 second difference in runtime between the two interpreters.

      but 50% sounds too horrendous for any developer to accept.

      I am not claiming 5.8.0 with threads is 50% slower across the board, just that it was 50% slower running one particular program. Please do run some of your own tests and post your results here.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://184176]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2024-04-24 09:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found