From: botp Date: 2011-03-08T14:40:29+09:00 Subject: Re: Hamming Distance On Tue, Mar 8, 2011 at 5:49 AM, Kirk Haines wrote: > On Mon, Mar 7, 2011 at 10:11 AM, Kirk Haines wrote: >> You can implement xor of two strings using pure ruby, but to get it >> fast, you'll probably want to utilize an extension.  Here's one > Actually, I should revise that statement.  To get it really fast with > MRI, you'll probably want to utilize an extension.  I am guessing, as > I haven't benchmarked anything, but one may well be able to get much > faster pure ruby speeds with jruby or rubinius.  When in doubt, > benchmark it! am staying w your modest narray implem ;-) $ ruby test_hamming_distance.rb Rehearsal ------------------------------------------------ kirk narray 0.140000 0.030000 0.170000 ( 0.160551) robert zip 1 22.570000 0.010000 22.580000 ( 22.589685) robert zip 2 22.870000 0.020000 22.890000 ( 22.922881) -------------------------------------- total: 45.640000sec user system total real kirk narray 0.050000 0.030000 0.080000 ( 0.080348) robert zip 1 22.490000 0.090000 22.580000 ( 22.805407) robert zip 2 22.900000 0.040000 22.940000 ( 22.963609) wow, your narray scheme is immune to length of string... thanks kirk and robert best regards -botp