Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Similarity of strings

by jmcnamara (Monsignor)
on May 15, 2002 at 15:13 UTC ( [id://166742]=note: print w/replies, xml ) Need Help??


in reply to Similarity of strings


I'd guess that the xor method is probably quicker but you could benchmark these as well:
# Method 1 my @a1 = split //, $ref_seq; my @a2 = split //, $test_seq; $score += ($a1[$_] eq $a2[$_]) for 0 .. $#a1; # Method 2, Destructive $score += (chop $ref_seq eq chop $test_seq) while $ref_seq;

--
John.

Replies are listed 'Best First'.
Re: Re: Similarity of strings
by professa (Beadle) on May 15, 2002 at 15:31 UTC
    chop is a bit faster than substr, it needs ~5 seconds instead of 7 seconds.

    Thanx, Micha

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://166742]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2024-04-18 07:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found