[Israel.pm] lecture slides

Shlomo Yona shlomo at cs.haifa.ac.il
Sun Jan 11 22:50:55 PST 2004


On Mon, 12 Jan 2004, Lary Ecker wrote:

> Regarding edit distance lecture, slide 22.
> For performance reason I think that instead of :
> my @A=split //,$ARGV[0];
> my @B=split //,$ARGV[1];
> Better:
> my @A = unpack "U*", $ARGV[0];
> my @B = unpack "U*", $ARGV[1];
> Which implies later a numeric comparison : my $p=($A[$i-1] == $B[$j-1])?0:1;
> Also better (for real work) put the two lines of the minimum function
> directly in the program and save the sub calling overhead.

Thanks for your comments.
I am pleased that people actually access the slides after
the lecture.

Both ideas are nice. I agree with your points.
It is important to use the U (unicode character) specifier,
and not the C (where character==byte) specifier. But, this
suffers from some backward compatibility issues.
Nonetheless, it is a nice was to speed that part up.


-- 
Shlomo Yona
shlomo at cs.haifa.ac.il
http://cs.haifa.ac.il/~shlomo/




More information about the Perl mailing list