Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 21 lines (18 sloc) 0.504 kB
c90fafb @weppos String & Regexp benchmarks.
authored
1 $:.unshift(File.dirname(__FILE__) + '/../lib')
2 require 'benchmark'
3
4
5 Benchmark.bmbm do |x|
6 string = File.read(File.expand_path("../../spec/fixtures/responses/whois.nic.tr/registered.txt", __FILE__))
7 result = "2010-Aug-22."
8 x.report("w/i delimiter") do
9 100_000.times do
10 string =~ /^Expires on\.+:\s+(.+)\n/
11 $1 == result || raise
12 end
13 end
14 x.report("w/o delimiter") do
15 100_000.times do
16 string =~ /Expires on\.+:\s+(.+)\n/
17 $1 == result || raise
18 end
19 end
20 end
Something went wrong with that request. Please try again.