Skip to content
  • Benchmark.bm do |x|
      x.report("100") { 100.times { filechecker.instance_variable_set(:@watched, nil); filechecker.send(:watched) } }
      x.report("500") { 500.times { filechecker.instance_variable_set(:@watched, nil); filechecker.send(:watched) } }
      x.report("1000") { 1000.times { filechecker.instance_variable_set(:@watched, nil); filechecker.send(:watched) } }
    end
           user     system      total        real
    100  1.848159   4.299229   6.147388 (  6.168887)
    500  9.300296  21.366761  30.667057 ( 30.745420)
    1000 19.483886  44.818354  64.302240 ( 64.836183)
    Edited by Thong Kuah
  • paths = filechecker.send(:watched)
    Benchmark.bm do |x|
      x.report("100") { 100.times { filechecker.send(:max_mtime, paths) } }
      x.report("500") { 500.times { filechecker.send(:max_mtime, paths) } }
      x.report("1000") { 1000.times { filechecker.send(:max_mtime, paths) } }
    end
           user     system      total        real
    100  1.426184   3.571109   4.997293 (  5.026946)
    500  7.087467  17.499392  24.586859 ( 24.639787)
    1000 14.260406  35.296779  49.557185 ( 49.607833)
  • @glob = filechecker.instance_variable_get :@glob
    Benchmark.bm do |x|
      x.report("100") { 100.times { Dir[@glob] } }
      x.report("500") { 500.times { Dir[@glob] } }
      x.report("1000") { 1000.times { Dir[@glob] } }
    end
           user     system      total        real
    100  1.893343   4.713202   6.606545 (  6.740979)
    500  9.211575  21.604094  30.815669 ( 30.887512)
    1000 18.438504  43.192094  61.630598 ( 61.936676)
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment