From: Brian Candler Date: 2003-04-03T21:23:41+09:00 Subject: Re: Newbie question:read file speed On Thu, Apr 03, 2003 at 06:47:49PM +0900, Peter Hickman wrote: > 13.47 8.46 1.41 45425 0.03 0.03 Fixnum#== > 9.65 9.47 1.01 45425 0.02 0.02 Fixnum#% > 9.36 10.45 0.98 45425 0.02 0.02 Fixnum#+ I wonder why Fixnum#== is slower than % or + ? I think that's just an artefact of the profiler. $ time ruby -e '1_000_000.times { 1 == 1 }' real 0m2.366s user 0m2.292s sys 0m0.001s $ time ruby -e '1_000_000.times { 1 + 1 }' real 0m2.366s user 0m2.302s sys 0m0.000s and repeat to be sure: $ time ruby -e '1_000_000.times { 1 == 1 }' real 0m2.440s user 0m2.291s sys 0m0.000s $ time ruby -e '1_000_000.times { 1 + 1 }' real 0m2.426s user 0m2.306s sys 0m0.000s The source for fix_equal could hardly be simpler. Cheers, Brian.