[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 11:18:19PM -0400, Michael G Schwern wrote:
> 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)


You know, without giving us the data you used to perform these tests, 
the numbers are meaningless.

But given that you only have one set of numbers, suggesting you only 
used one set of strings, even with the data, the numbers would be 
meaningless.

The running time of the code depends highly on the data the code is run
on. You'd need to run the code on many pairs of strings before you could
attempt answering the question "which one is faster?".



Abigail

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