{"id":16327063,"url":"https://github.com/mrmlnc/bencho","last_synced_at":"2025-10-29T12:09:13.975Z","repository":{"id":152165597,"uuid":"544384601","full_name":"mrmlnc/bencho","owner":"mrmlnc","description":"A command-line benchmarking tool.","archived":false,"fork":false,"pushed_at":"2023-04-08T10:05:34.000Z","size":25,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-25T20:43:36.389Z","etag":null,"topics":["benchmark"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/mrmlnc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE-OF-CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-02T10:45:29.000Z","updated_at":"2023-07-04T08:25:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"0ccbf559-bcbb-46f1-94cb-7d6104b1736e","html_url":"https://github.com/mrmlnc/bencho","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mrmlnc/bencho","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrmlnc%2Fbencho","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrmlnc%2Fbencho/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrmlnc%2Fbencho/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrmlnc%2Fbencho/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrmlnc","download_url":"https://codeload.github.com/mrmlnc/bencho/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrmlnc%2Fbencho/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281617884,"owners_count":26532032,"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","status":"online","status_checked_at":"2025-10-29T02:00:06.901Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["benchmark"],"created_at":"2024-10-10T23:10:18.784Z","updated_at":"2025-10-29T12:09:13.944Z","avatar_url":"https://github.com/mrmlnc.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bencho\n\n\u003e A command-line benchmarking tool.\n\n\u003e :book: This is an early version of the package.\n\nBencho is inspired by [hyperfine](https://github.com/sharkdp/hyperfine). The main difference is the method of measurement. Measurements in Bencho are based on markers placed inside the process being measured. Any number of markers. Supports marker types. Any programming language. Any framework. Any integration with other tools like OpenTelemetry or loggers.\n\nSee the example in the [`./examples/min.js`](./examples/min.js) file.\n\n```php\n$ bencho 'node --expose-gc ./examples/min.js {mode}' -n 'min.js {mode}' -r 1 -l mode=math,math-spread,loop,sort,reduce --reporter benchmark --allow-multiple\n\nMarker        Type    Command             Mean       StdDev       StdDev, %  Ratio   Lowest\n------------  ------  ------------------  ---------  -----------  ---------  ------  ------\ntime          time    min.js math           0.148ms      0.017ms    11.744%    1.00     yes\ntime          time    min.js math-spread    0.152ms      0.027ms    17.487%    1.03\ntime          time    min.js loop           0.241ms      0.341ms   141.105%    1.63\ntime          time    min.js sort          18.774ms      0.528ms     2.815%  126.58\ntime          time    min.js reduce         1.246ms      0.066ms     5.270%    8.40\n\nmemory        memory  min.js math         4.180 MiB  130.722 kiB     3.054%    1.00     yes\nmemory        memory  min.js math-spread  4.251 MiB  104.033 kiB     2.390%    1.02\nmemory        memory  min.js loop         4.358 MiB  415.165 kiB     9.304%    1.04\nmemory        memory  min.js sort         6.026 MiB  163.173 kiB     2.644%    1.44\nmemory        memory  min.js reduce       4.411 MiB  132.157 kiB     2.926%    1.06\n\nmax           value   min.js math             99999            0     0.000%    1.00     yes\nmax           value   min.js math-spread      99999            0     0.000%    1.00     yes\nmax           value   min.js loop             99999            0     0.000%    1.00     yes\nmax           value   min.js sort             99999            0     0.000%    1.00     yes\nmax           value   min.js reduce           99999            0     0.000%    1.00     yes\n\nprocess.time  time    min.js math            4.018s          0ms     0.000%    1.00\nprocess.time  time    min.js math-spread     4.011s          0ms     0.000%    1.00     yes\nprocess.time  time    min.js loop            4.028s          0ms     0.000%    1.00\nprocess.time  time    min.js sort            5.873s          0ms     0.000%    1.46\nprocess.time  time    min.js reduce          4.124s          0ms     0.000%    1.03\n```\n\n## How does it work?\n\nIn the code you place markers for time, memory or any numeric values. Markers write information to stdout or stderr.\n\nExamples of such a marker:\n\n```js\nbencho_marker:\u003cmarker_label\u003e;\u003cmarker_type\u003e;\u003cmarker_value\u003e\n\nbencho_marker:time;time;${time}\nbencho_marker:memory;memory;${memory}\nbencho_marker:counter;value;${counter}\n```\n\n\u003e :book: Bencho does not perform any manipulations with your code.\n\u003e\n\u003e In general, you can use `console.log` or `console.error` when you put markers in the benchmark code. In more complex cases, you can work with markers by condition to be able to cut them out at build time for production.\n\nRun bencho, specifying the necessary number of warm-up and main runs. Bencho starts the process and collects marker information from stdout and stderr.\n\nThen the markers are processed and the statistics are calculated. And boom! You can see the results.\n\n## Installation\n\n\u003e :book: Right now we only support installation from the `npm` registry.\n\n```console\nnpm install bencho\n```\n\n## Usage\n\nCheck our help using the `bencho --help` command and see examples in the `./examples` directory.\n\nAn example of your code before using this package:\n\n```js\n// ./code.mjs\nasync function findAllEmptyResolutions() { /* code */ }\n\nawait findAllEmptyResolutions();\n```\n\nInstrumented code:\n\n```js\n// ./code.mjs\nimport { performance } from 'node:perf_hooks';\nimport * as bencho from 'bencho';\n\nasync function findAllEmptyResolutions() { /* code */ }\n\nconst startTime = performance.now();\n\n// Calling the measured function.\nawait findAllEmptyResolutions();\n\n// Calculating values for metrics.\nconst time = performance.now() - startTime;\nconst memory = process.memoryUsage().heapUsed;\n\n// Report markers.\nbencho.time('time', time);\nbencho.memory('memory', memory);\n```\n\nCommand to run:\n\n```shell\n$ bencho 'node ./code.mjs' -w 10 -r 50\n```\n\nResults:\n\n```php\nBenchmark #1\nCommand:    node ./code.mjs\n            node ./code.mjs\n\nMarker        Type    Mean       StdDev   StdDev, %  Min        Max\n------------  ------  ---------  -------  ---------  ---------  ---------\ntime          time      0.011ms  0.002ms    19.064%    0.008ms    0.017ms\nprocess.time  time     36.135ms  2.163ms     5.985%   33.077ms   43.087ms\nmemory        memory  5.127 MiB  0.000 B     0.000%  5.127 MiB  5.127 MiB\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrmlnc%2Fbencho","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrmlnc%2Fbencho","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrmlnc%2Fbencho/lists"}