module RequireBench

Constants

SKIP_PATTERN
TIMINGS
VERSION

Public Instance Methods

require_with_timing(file) click to toggle source
# File lib/require_bench.rb, line 24
def require_with_timing(file)
  $require_bench_semaphore = true
  ret = nil
  seconds = Benchmark.realtime { ret = Kernel.send(:require_without_timing, file) }
  printf("[RequireBench] %10f %s\n", seconds, file)
  path_parts = file.split('/')
  prefix = path_parts.first
  # requires that were fully qualified paths probably need to be identified
  #   by the full path
  prefix = file if prefix.nil? || prefix.empty?
  RequireBench::TIMINGS[prefix] += seconds
  ret
ensure
  $require_bench_semaphore = nil
end