Faster

Benchmark.bmbm do |x|
  x.report("readlines") { File.readlines(filename).size }
  x.report("read") { File.open(filename).read.count $/ }
end
Double dash is not mandatory
Optimize long operations thanks to ruby-prof