Project

General

Profile

Bug #12373 » string-start_with.rb

ksss (Yuki Kurihara), 05/12/2016 12:39 AM

 
#! /usr/bin/env ruby

require 'benchmark/ips'

a = "abcdefg"
b = '"'
Benchmark.ips do |x|
x.report("a[0] == b") do
a[0] == b
end
x.report("a.start_with?(b)") do
a.start_with?(b)
end
x.compare!
end
(4-4/9)