From: Edoardo Rossi Date: 2013-05-01T06:58:38+09:00 Subject: Re: is there any performance difference between Range#include? and Range#cover? On Tue, Apr 30, 2013 at 11:17 PM, Joel Pearson wrote: > I'd expect cover to perform better in a benchmark, since it checks the > min-max rather than the entire range. > > -- > Posted via http://www.ruby-forum.com/. > Humm... irb(main):010:0> require 'benchmark' => true irb(main):011:0> Benchmark.bm do |x| irb(main):012:1* x.report('include') { 10000000.times { (0..99).include?(rand(1000))}} irb(main):013:1> x.report('cover') { 10000000.times { (0..99).cover?(rand(1000))}} irb(main):014:1> end user system total real include 5.790000 0.000000 5.790000 ( 5.802889) cover 5.830000 0.000000 5.830000 ( 5.826916) Hope this helps... but maybe my benchmark is not accurate as it should be? e.