Actions
Bug #13773
closedImprove String#prepend performance if only one argument is given
Bug #13773:
Improve String#prepend performance if only one argument is given
Description
This is very similar with https://github.com/ruby/ruby/pull/1634
If only one argument is given, this will prepend the string without
generating temporary object.
Before¶
After¶
Test code¶
require 'benchmark/ips'
Benchmark.ips do |x|
x.report "String#prepend" do |loop|
loop.times { "!".prepend("hello") }
end
end
Patch¶
Actions