require 'benchmark'

def benchmark(&block)
  runs = 100
  total = 0

  runs.times do 
    total += Benchmark.measure(&block) 
  end

  total / runs 
end

def with_utf8_file(filename)
  File.open(filename, 'r:utf-8') do |file|
    yield file.read
  end
end

require 'benchmark'

def benchmark(&block)
  runs = 100
  total = 0

  runs.times do |i|
    result = Benchmark.measure(&block).total
    $stderr.puts "Run #{i}: #{result}"
    total += result
  end

  total / runs 
end

def with_utf8_file(filename)
  File.open(filename, 'r:utf-8') do |file|
    yield file.read
  end
end

Fix bug (need to call total on Tms object)
Fix bug (need to call total on Tms object)
