From bfb2acca5bcec3c867490384b17cd423a26701df Mon Sep 17 00:00:00 2001 From: burningTyger Date: Mon, 14 Mar 2011 22:52:20 +0100 Subject: [PATCH] bench added #clone and #new to String dup --- benchmark/core/string/bench_dup.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/benchmark/core/string/bench_dup.rb b/benchmark/core/string/bench_dup.rb index c20d87b9e4..e5373a9ece 100644 --- a/benchmark/core/string/bench_dup.rb +++ b/benchmark/core/string/bench_dup.rb @@ -12,4 +12,20 @@ end end + x.report "clone strings" do |times| + i = 0 + while i < times + string.clone + i += 1 + end + end + + x.report "create new strings" do |times| + i = 0 + while i < times + String.new(string) + i += 1 + end + end + end