fork download
  1. #!/usr/local/bin/ruby -w
  2.  
  3. # 'lib prime'
  4.  
  5. require 'benchmark'
  6. require 'prime'
  7.  
  8. RANGE = -50..99999
  9.  
  10. Benchmark.bm do |bm|
  11. bm.report{RANGE.select(&:prime?)}
  12. end
  13.  
  14. p((-5..10).select(&:prime?))
Success #stdin #stdout 1.66s 5024KB
stdin
Standard input is empty
stdout
      user     system      total        real
  1.640000   0.000000   1.640000 (  1.652189)
[-5, -3, -2, 2, 3, 5, 7]