From: Ben Tilly Date: 2000-12-28T22:58:12+09:00 Subject: [ruby-talk:8175] Re: speedup of anagram finder "Joseph McDonald" wrote: > > >any ideas how to speed this up?: > >#!/usr/local/bin/ruby ># Takes a list or words, finds all anagrams in it [...] >The idea comes from Ben Tilly's version at: >http://www.perlmonks.org/index.pl?node_id=33383&lastnode_id=33390 > [...] > >The perl version runs at least twice as fast. You know, had I known how much discussion this would generate, I might have optimized the original Perl a little. :-) I actually have quite a bit of code on that site which would make for interesting comparisons. For instance I have to wonder what a native Ruby version of http://www.perlmonks.org/index.pl?node_id=41961 would look like. Note in particular the use of anonymous subs to do what an iterator does. Note also the hoops I jump through to control round-off error. Cheers, Ben _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com