elasticsearch-ruby
https://github.com/elastic/elasticsearch-ruby
Ruby
Ruby integrations for Elasticsearch
Benchmark.bm
A simple interface to the #benchmark method, #bm generates sequential
reports with labels. The parameters have the same meaning as for
#benchmark.
require 'benchmark'
n = 5000000
Benchmark.bm(7) do |x|
x.report("for:") { for i in 1..n; a = "1"; end }
x.report("times:") { n.times do ; a = "1"; end }
x.report("upto:") { 1.upto(n) do ; a = "1"; end }
end
Generates:
user system total real
for: 0.960000 0.000000 0.960000 ( 0.957966)
times: 0.960000 0.000000 0.960000 ( 0.960423)
upto: 0.950000 0.000000 0.950000 ( 0.954864)Edit
git clone [email protected]:elastic/elasticsearch-ruby.git
cd elasticsearch-ruby
open
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-Benchmark-bm-for-pr
# Commit to gitgit add git commit -m "better docs for Benchmark.bm"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-Benchmark-bm-for-pr
hub pull-request
# Celebrate!