Iñaki Baz Castillo wrote:
> El Miércoles, 4 de Marzo de 2009, C. Dagnon escribió:
>> I had been doing that, but then I thought that compiling a single regex
>> would be less expensive than downcasing everything every time they got
>> compared.
> 
> Let's do some benchmarks:
> ...
> Did you know the String#casecmp method? It seems to be the faster way.

Nope, didn't hear about that, nor Benchmark.realtime.  Thanks - these 
look useful!

My only suggestion would be that we try it against 100, 10,000, and 
larger sets of strings to see which is faster - this is over a 
collection after all.  I wasn't assuming a Regexp.compile would be 
faster than other things for a single string compare.
-- 
Posted via http://www.ruby-forum.com/.