mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
18 lines
No EOL
359 B
Ruby
18 lines
No EOL
359 B
Ruby
require 'benchmark'
|
|
|
|
COUNT = 1000
|
|
data = "Content-Length: 100"
|
|
Benchmark.bmbm(25) do |bench|
|
|
bench.report('regex') do
|
|
COUNT.times do
|
|
header = data.match(/(.*):\s(.*)/)
|
|
"#{header[1]}: #{header[2]}"
|
|
end
|
|
end
|
|
bench.report('split') do
|
|
COUNT.times do
|
|
header = data.split(': ')
|
|
"#{header[0]}: #{header[1]}"
|
|
end
|
|
end
|
|
end |