Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
1 contributor

Users who have contributed to this file

20 lines (15 sloc) 257 Bytes
# frozen_string_literal: true
require 'benchmark/ips'
if RUBY_VERSION >= '2.3.0'
def fast
+''
end
def slow
''.dup
end
Benchmark.ips do |x|
x.report('String#+@') { fast }
x.report('String#dup') { slow }
x.compare!
end
end
You can’t perform that action at this time.