Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

18 lines (16 sloc) 0.434 kB
$:.unshift(File.dirname(__FILE__) + '/../lib')
require 'benchmark'
Benchmark.bmbm do |x|
string = "mimas.rh.com.tr\t\t77.75.34.2"
result = %w( mimas.rh.com.tr 77.75.34.2 )
x.report("split & strip") do
100_000.times do
string.split("\s").map { |value| value.strip } == result || raise
end
end
x.report("split with regexp") do
100_000.times do
string.split(/\s+/) == result || raise
end
end
end
Jump to Line
Something went wrong with that request. Please try again.