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

Re: [FWP] Quick hack for common length



On 26 Jun 2001, at 16:43, Michael G Schwern wrote:

> On Tue, Jun 26, 2001 at 07:14:53PM +0200, Abigail wrote:
> > You know, without giving us the data you used to perform these tests, 
> > the numbers are meaningless.
> 
> Actually I ran it a bunch of times with big and small strings with
> different amounts of commonality, but it all came out pretty much the
> same.  You're right, of course, I didn't do a proper, complete
> benchmark report.  But as this is Fun With Perl and not Hardcore
> Performance Benchmarking I didn't think it necessary to get into too
> much depth.

Yeah, but one thing DOES make a difference: some of the algorithms 
stop after the first non-match... others compare the ENTIRE string 
and THEN look for the first non-matching char.  I'd guess that if you 
try a benchmark with, say, strings that are 10^6 with maybe 20/30 
chars in common at the beginning, the algorithms would "spread" a 
bit...  OTOH, I could well believe that in any even half-normal app, 
that you'd not be likely to be dealing with strings long enough that 
that 'effect' would make muchof/any difference.

This is more of an issue with sort algorithms, where coincidences in 
the data and the vast differences in dataset size can/do make *huge* 
differences in which sort of algorithm works best...

  /Bernie\

-- 
Bernie Cosell                    Fantasy Farm Fibers
bernie@fantasyfarm.com           Pearisburg, VA

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