From: "Iñaki Baz Castillo" Date: 2009-03-05T06:49:39+09:00 Subject: Re: Any solutions to Ruby's inconsistencies? 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: ----------- irb> aaa="HolaQueTAL" irb> bbb="holaQUEtal" irb> Benchmark.realtime { aaa.downcase == bbb.downcase } 1.97887420654297e-05 irb> Benchmark.realtime { aaa.casecmp(bbb) } 1.59740447998047e-05 irb> Benchmark.realtime { aaa =~ /^#{bbb}$/i } 3.19480895996094e-05 --------------- Did you know the String#casecmp method? It seems to be the faster way. -- Iñaki Baz Castillo