{"id":15537670,"url":"https://github.com/cibernox/bencher","last_synced_at":"2025-07-05T20:37:18.347Z","repository":{"id":16596754,"uuid":"19351223","full_name":"cibernox/bencher","owner":"cibernox","description":"Simplest benchmarking library for ruby","archived":false,"fork":false,"pushed_at":"2018-02-20T09:52:49.000Z","size":6,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-29T20:12:39.719Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cibernox.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-05-01T16:59:36.000Z","updated_at":"2014-05-01T21:46:42.000Z","dependencies_parsed_at":"2022-07-26T06:16:08.865Z","dependency_job_id":null,"html_url":"https://github.com/cibernox/bencher","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cibernox%2Fbencher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cibernox%2Fbencher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cibernox%2Fbencher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cibernox%2Fbencher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cibernox","download_url":"https://codeload.github.com/cibernox/bencher/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247117765,"owners_count":20886439,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-02T11:59:01.147Z","updated_at":"2025-04-04T04:13:43.398Z","avatar_url":"https://github.com/cibernox.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bencher\n\nSimple library to run the simples benchmarks possible.\n\nJust measure times and objects allocation.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n    gem 'bencher'\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install bencher\n\n## Usage\n\nYou can create benchmarks just writting classes that inherit from\n`Bencher::Benchmark`.\n\nThose classes **must** define a `benchmark` method where you place the code to\nbe measured.\n\n```ruby\nclass MyBenchmark \u003c Bencher::Benchmark\n  def benchmark(reporter)\n    repetitions = 1_000_000\n\n    reporter.report \"#method_a\" do\n      repetitions.times do |number|\n        method_a(number)\n      end\n    end\n\n    reporter.report \"#method_b\" do\n      repetitions.times do |number|\n        method_b(number)\n      end\n    end\n  end\nend\n```\n\nYou can run the benchmarks from inside the console\n\n```\n[1] pry(main)\u003e require_relative \"benchmarks/my_benchmark\" # =\u003e true\n[2] pry(main)\u003e LoadSquadBenchmark.new.run\n=\u003e [#\u003cBenchmark::Tms:0x007fd2014a29e8\n  @cstime=0.0,\n  @cutime=0.0,\n  @label=\"#method_a\",\n  @real=12.972949,\n  @stime=0.6799999999999999,\n  @total=7.82,\n  @utime=7.140000000000001\u003e,\n #\u003cBenchmark::Tms:0x007fd1e2914c70\n  @cstime=0.0,\n  @cutime=0.0,\n  @label=\"#method_b\",\n  @real=4.676458,\n  @stime=0.28,\n  @total=3.5200000000000005,\n  @utime=3.24\u003e,\n {:TOTAL=\u003e8858772, :FREE=\u003e-179860, :T_OBJECT=\u003e393666, :T_CLASS=\u003e3577,\n  :T_MODULE=\u003e7, :T_FLOAT=\u003e0, :T_STRING=\u003e4047708, ... }\n]\n```\n\nOr using the command line utility:\n\n```\n$ bundle exec bencher benchmarks/\n    user     system      total        real\n  5.940000   0.550000   6.490000 (  8.107446)\n  2.750000   0.260000   3.010000 (  3.564494)\n  1.940000   0.290000   2.230000 (  3.160562)\n{:TOTAL=\u003e8982685, :T_OBJECT=\u003e393666, :T_CLASS=\u003e3577, :T_MODULE=\u003e7, :T_FLOAT=\u003e0, :T_STRING=\u003e4099013, ...}\n```\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcibernox%2Fbencher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcibernox%2Fbencher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcibernox%2Fbencher/lists"}