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

Re: [FWP] Quick hack for common length



On Tue, Jun 26, 2001 at 05:49:57PM -0400, bernie@fantasyfarm.com wrote:
> 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.

On the other hands, with "small" strings, the difference is time is
insignificant. And I think in even half-normal applications, it's more
likely to compare two strings of size 10^6, than to compare 10^6 pairs
of strings.



Abigail

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