{"id":13719160,"url":"https://github.com/v0dro/benchmark-plot","last_synced_at":"2026-01-26T02:06:02.189Z","repository":{"id":62554107,"uuid":"60453639","full_name":"v0dro/benchmark-plot","owner":"v0dro","description":"A Ruby benchmark extension to allow comparative plotting of benchmarks.","archived":false,"fork":false,"pushed_at":"2016-07-10T18:00:46.000Z","size":396,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-31T16:16:31.221Z","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":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/v0dro.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-05T09:57:59.000Z","updated_at":"2023-03-05T13:06:09.000Z","dependencies_parsed_at":"2022-11-03T04:45:47.265Z","dependency_job_id":null,"html_url":"https://github.com/v0dro/benchmark-plot","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/v0dro%2Fbenchmark-plot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/v0dro%2Fbenchmark-plot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/v0dro%2Fbenchmark-plot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/v0dro%2Fbenchmark-plot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/v0dro","download_url":"https://codeload.github.com/v0dro/benchmark-plot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239754486,"owners_count":19691298,"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-08-03T01:00:43.524Z","updated_at":"2026-01-26T02:05:57.169Z","avatar_url":"https://github.com/v0dro.png","language":"Ruby","funding_links":[],"categories":["Visualization"],"sub_categories":[],"readme":"# benchmark-plot\n\nA Ruby benchmark extension to allow comparative plotting of benchmarks.\n\n# Screencast\n\nWatch a screencast of gem usage [here](https://www.youtube.com/watch?v=WW6M4Df-soQ).\n\n# Usage\n\nThis gem is mainly useful for benchmarking code over a number of inputs. This input should be supplied in the form of an object capable of calling `#each`.\n\nSample benchmarking script:\n\n``` ruby\nrequire 'benchmark/plot'\n\nclass TestArray\n  attr_reader :arr\n\n  def initialize arr\n    @arr = arr\n  end\n\n  def to_s\n    @arr.size.to_s\n  end\nend\n\ntest_data = [5, 25, 50, 75, 100, 125, 150, 175, 200,250,300]\ntest_data.map! {|e| TestArray.new(Array.new(e) {|i| i}) }\n\nBenchmark.plot(test_data) do |x|\n  x.report(\"map.flatten\") do |data|\n    data.arr.map { [nil]  }.flatten\n  end\n\n  x.report(\"flat_map\") do |data|\n    data.arr.flat_map { [nil] }\n  end\nend\n```\n\nOutput:\n\n![Benchmarks](examples/mapflat_vs_flat_map/benchmark_plot_graph.png)\n\n# Acknowledgements\n\n[@tgxworld](https://github.com/tgxworld) for providing the co-working space during the Open Source Breakfast Hack during Red Dot Ruby Conference 2016 where this gem was built.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fv0dro%2Fbenchmark-plot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fv0dro%2Fbenchmark-plot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fv0dro%2Fbenchmark-plot/lists"}