Skip to content

Commit 4aacee7

Browse files
committed
Add ruby benchmark
1 parent efff286 commit 4aacee7

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

snippets/ruby/ruby.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,26 @@
2929
"end"
3030
]
3131
},
32+
"Ruby Benchmark Measure": {
33+
"prefix": "benchm",
34+
"body": [
35+
"require 'benchmark'",
36+
"",
37+
"puts Benchmark.measure { ${1:# benchmark code} }"
38+
]
39+
},
40+
"Ruby Benchmark BM": {
41+
"prefix": "benchbm",
42+
"body": [
43+
"require 'benchmark'",
44+
"",
45+
"n = ${1:50000}",
46+
"Benchmark.bm do |x|",
47+
" x.report(\"${2:Task 1}\") { n.times { ${3:\"task 1\"} } }",
48+
" x.report(\"${4:Task 2}\") { n.times { ${5:\"task 2\"} } }",
49+
"end"
50+
]
51+
},
3252
"Class definition with initialize": {
3353
"prefix": "class init",
3454
"body": [

0 commit comments

Comments
 (0)