[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 08:07:36PM -0400, Jeff 'japhy' Pinyan wrote:
> On Jun 25, Clinton A. Pierce said:
> 
> >sub comlen_or {
> >	length((($_[0]^$_[1])=~m/^(\0+)/)[0]);
> >}
> 
> This requires 5.6.
> 
>   sub comlen_japhy {
>     (pop ^ pop) =~ /^\0*/ and $+[0];
>   }

Doesn't seem to run any faster.

Benchmark: running Inline_C, Japhy, Perl, each for at least 3 CPU seconds...
  Inline_C:  3 wallclock secs ( 3.15 usr +  0.00 sys =  3.15 CPU) @ 347539.37/s (n=1094749)
     Japhy:  3 wallclock secs ( 3.21 usr +  0.01 sys =  3.22 CPU) @ 49496.58/s (n=159379)
      Perl:  3 wallclock secs ( 3.24 usr +  0.00 sys =  3.24 CPU) @ 50580.56/s (n=163881)


-- 

Michael G. Schwern   <schwern@pobox.com>    http://www.pobox.com/~schwern/
Perl6 Quality Assurance     <perl-qa@perl.org>	     Kwalitee Is Job One
"You killed my fish?"
"Why does that pickle you?"
	http://sluggy.com/d/010204.html

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