[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Quick hack for common length



On Mon, Jun 25, 2001 at 06:39:50PM -0700, Ira Woodhead wrote:
> How about:
> 
> sub comlen {
> 	int( ( index unpack("b*", pop^pop), 1 )/8 );
> }
> 
> No regex, no list context, as per instructions,

This one looks to be just a tad bit slower than the rest.

Interestingly enough, the Inline::C version is actually *faster* than
the no-op control stub I put into my benchmark!

Benchmark: running Inline_C, Ira, Japhy, Perl, no_op, each for at least 3 CPU seconds...
  Inline_C:  3 wallclock secs ( 3.02 usr +  0.00 sys =  3.02 CPU) @ 347297.35/s (n=1048838)
       Ira:  4 wallclock secs ( 3.14 usr +  0.00 sys =  3.14 CPU) @ 47495.54/s (n=149136)
     Japhy:  4 wallclock secs ( 3.18 usr +  0.00 sys =  3.18 CPU) @ 49924.21/s (n=158759)
      Perl:  3 wallclock secs ( 3.12 usr +  0.01 sys =  3.13 CPU) @ 50296.17/s (n=157427)
     no_op:  5 wallclock secs ( 3.02 usr +  0.00 sys =  3.02 CPU) @ 208522.52/s (n=629738)

(n or #/s is what you want to look at)

-- 

Michael G. Schwern   <schwern@pobox.com>    http://www.pobox.com/~schwern/
Perl6 Quality Assurance     <perl-qa@perl.org>	     Kwalitee Is Job One
BOFH excuse #349:

Stray Alpha Particles from memory packaging caused Hard Memory Error on Server.

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe