summaryrefslogtreecommitdiff
path: root/benchmark
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-15 06:14:42 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-15 06:14:42 (GMT)
commit9a9a4e874d2257fcdb6fba0be5fa6fb3c402076d (patch)
treec0e3285b046c8971a40259c8e4ad93084b4dfcd1 /benchmark
parent0efd8bbd34117437f0e1584fe1c1f2177ed09d0d (diff)
Benchmarks for Array#values_at
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/bm_array_values_at_int.rb2
-rw-r--r--benchmark/bm_array_values_at_range.rb2
2 files changed, 4 insertions, 0 deletions
diff --git a/benchmark/bm_array_values_at_int.rb b/benchmark/bm_array_values_at_int.rb
new file mode 100644
index 0000000..6cb394c
--- /dev/null
+++ b/benchmark/bm_array_values_at_int.rb
@@ -0,0 +1,2 @@
+ary = Array.new(10000) {|i| i}
+100000.times { ary.values_at(500) }
diff --git a/benchmark/bm_array_values_at_range.rb b/benchmark/bm_array_values_at_range.rb
new file mode 100644
index 0000000..5b53806
--- /dev/null
+++ b/benchmark/bm_array_values_at_range.rb
@@ -0,0 +1,2 @@
+ary = Array.new(10000) {|i| i}
+100000.times { ary.values_at(1..2000) }