{"id":14966163,"url":"https://github.com/tony-o/perl6-bench","last_synced_at":"2025-07-11T20:33:54.814Z","repository":{"id":22895076,"uuid":"26243472","full_name":"tony-o/perl6-bench","owner":"tony-o","description":"perl6 benchmark module","archived":false,"fork":false,"pushed_at":"2021-01-19T21:58:35.000Z","size":26,"stargazers_count":6,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-31T07:51:26.611Z","etag":null,"topics":["bench","benchmark","iteration","perl-6","perl6","utility"],"latest_commit_sha":null,"homepage":"","language":"Raku","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tony-o.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-11-05T22:52:02.000Z","updated_at":"2022-10-18T05:07:42.000Z","dependencies_parsed_at":"2022-08-21T15:31:29.418Z","dependency_job_id":null,"html_url":"https://github.com/tony-o/perl6-bench","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/tony-o%2Fperl6-bench","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tony-o%2Fperl6-bench/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tony-o%2Fperl6-bench/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tony-o%2Fperl6-bench/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tony-o","download_url":"https://codeload.github.com/tony-o/perl6-bench/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238174090,"owners_count":19428624,"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":["bench","benchmark","iteration","perl-6","perl6","utility"],"created_at":"2024-09-24T13:35:56.861Z","updated_at":"2025-02-10T19:30:41.742Z","avatar_url":"https://github.com/tony-o.png","language":"Raku","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bench[mark]\n\nBenchmark tool for benchmarking how long a block of code runs for X iterations *or* how many times it can run in a given period.\n\nBench now uses Telemetry if you have it to show you the USR/SYS/CPU times, so your output below may look slightly different.\n\n# Usage\n\n```perl6\nuse Bench;\n\nmy $b = Bench.new;\n\n$b.timethese(1000, {\n  first  =\u003e sub { sleep .05; },\n  second =\u003e sub { sleep .005; },\n});\n'---------------------------------------------------------'.say;\n$b.cmpthese(1000, {\n  first  =\u003e sub { sleep .05; },\n  second =\u003e sub { sleep .005; },\n});\n```\n\nOutput\n\n```\nBenchmark:\nTiming 1000 iterations of first, second...\n     first: 51.5808 wallclock secs @ 19.3871/s (n=1000)\n    second: 6.4035 wallclock secs @ 156.1656/s (n=1000)\n---------------------------------------------------------\nBenchmark:\nTiming 1000 iterations of first, second...\n     first: 51.5511 wallclock secs @ 19.3982/s (n=1000)\n    second: 6.4145 wallclock secs @ 155.8971/s (n=1000)\nO--------O--------O-------O--------O\n|        | Rate   | first | second |\nO========O========O=======O========O\n| first  | 19.4/s | --    | -88%   |\n| second | 156/s  | 704%  | --     |\n------------------------------------\n```\n\n# Methods\n\n## .timestr(Array) returns Str\n\nTakes an array returned from any of the following methods and returns a formatted string with the data filled in.  The string is similar to below: ```6.4145 wallclock secs @ 155.8971/s (n=1000)``` \n\n## .timeit(Int $iterations, Sub) returns Array\n\nTimes a single sub over X iterations.  Doesn't output anything by default, just returns an array of time spent and iterations.  Use in conjunction with ```.timestr```\n\n## .countit(Rat $time, Sub) returns Array\n\nReturns how many iterations of the Sub it can run in the specified time.  Use in conjunction with ```.timestr```\n\n## .timethis(Int $iterations, Sub, Str :$title) returns Array\n\nRuns the specified sub for $iterations and automatically prints out the ```.timestr```.  If $iterations is negative or 0 then it runs ```.countit``` instead of ```.timeit```\n\n## .timethese(Int $iterations, Hash $Subs) returns Array\n\nSimilar to ```.timethis``` but the key in the hash becomes the title for the test.  An example of the output can be \n\n## .cmpthese(Int $iterations, Hash $Subs) returns Array\n\nSimilar to ```.timethese``` but it produces a cute little table comparing the results.\n\n# License\n\nDo whatever you want with it.\n\n# Authors\n\n[@tony-o](https://www.gittip.com/tony-o/)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftony-o%2Fperl6-bench","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftony-o%2Fperl6-bench","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftony-o%2Fperl6-bench/lists"}