From: andrea Date: 2009-01-02T17:10:10+09:00 Subject: Re: Building anagrams Thanks to everyone for your very nice answers, now I wrote another version of the program. http://pastie.textmate.org/private/ryxlzlqle8txaorswiynea Which implments all 3 methods discussed here, the nicest of course is the third. It creates signature only if really needed, otherwise it just loads the dict with Marshall. (other ways?) Is correct the use of md5?? I think it is as it gives the same result of the openssl md5, but it looks a little bit too fast for such a big file. dict_md5 = Digest::MD5.hexdigest(open(@dict).read) conf_md5 = open($CONF).read # then they must be equal and I have the correct # signatures for my dictionary if dict_md5 == conf_md5 puts "we already have the right signatures" if $DEBUG # loading the precomputed signature file @signatures = Marshal.load(open($SIGNATURE)) else It's not bad at all, the only problem is that with a huge dictionary it takes a long time to load it (around 38seconds for a almost 1- million word dictionary) and takes a big amount of ram. Could I maybe load it incrementally? Maybe divide the signs by size and load just what I need to check? Is it possible using only one file? Thanks a lot