{"id":51118967,"url":"https://github.com/sulthonzh/benchrun","last_synced_at":"2026-06-25T00:30:35.059Z","repository":{"id":363217391,"uuid":"1255412462","full_name":"sulthonzh/benchrun","owner":"sulthonzh","description":"Zero-dep microbenchmark runner for Node.js","archived":false,"fork":false,"pushed_at":"2026-06-19T19:15:54.000Z","size":17,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-19T21:13:40.326Z","etag":null,"topics":["benchmark","cli","microbenchmark","performance","stats"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/sulthonzh.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-31T19:50:33.000Z","updated_at":"2026-06-19T19:14:48.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/sulthonzh/benchrun","commit_stats":null,"previous_names":["sulthonzh/benchrun"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/sulthonzh/benchrun","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sulthonzh%2Fbenchrun","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sulthonzh%2Fbenchrun/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sulthonzh%2Fbenchrun/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sulthonzh%2Fbenchrun/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sulthonzh","download_url":"https://codeload.github.com/sulthonzh/benchrun/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sulthonzh%2Fbenchrun/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34755061,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-24T02:00:07.484Z","response_time":106,"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","cli","microbenchmark","performance","stats"],"created_at":"2026-06-25T00:30:34.930Z","updated_at":"2026-06-25T00:30:35.036Z","avatar_url":"https://github.com/sulthonzh.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# benchrun\n\nZero-dep microbenchmark runner for Node.js. Define suites, run them, get real stats.\n\n## Why?\n\nMost benchmark tools are either overkill (full framework) or too simple (`console.time`). `benchrun` sits in the middle — proper stats (mean, median, p95, p99, margin of error) with a tiny API and zero dependencies.\n\n## Install\n\n```bash\nnpm install benchrun\n```\n\n## Quick Start\n\n### Library\n\n```typescript\nimport { suite, runSuite, formatResult } from 'benchrun';\n\nconst cases = suite('string ops')\n  .add('concat', () =\u003e 'a' + 'b' + 'c')\n  .add('template', () =\u003e `${'a'}${'b'}${'c'}`)\n  .add('join', () =\u003e ['a', 'b', 'c'].join(''))\n  .build();\n\nconst result = await runSuite(cases, 'string ops', { iterations: 500, warmup: 20 });\nconsole.log(formatResult(result, 'text'));\n```\n\nOutput:\n\n```\n  string ops\n  ──────────────────────────────────────────────────\n  concat\n    ██████████████████████████████ 0.0003 ms/op  (3.33M ops/s)\n    median 0.0002 · p95 0.0008 · p99 0.0012 · MoE 5.2%\n  template\n    ████████████████████████████████ 0.0004 ms/op  (2.50M ops/s)\n    median 0.0003 · p95 0.0009 · p99 0.0015 · MoE 4.8%\n  join\n    ████████████████████████████████████████████████ 0.0012 ms/op  (833.33K ops/s)\n    median 0.0010 · p95 0.0025 · p99 0.0031 · MoE 3.1%\n\n  Fastest: concat\n```\n\n### CLI\n\n```bash\n# Run a benchmark file\nbenchrun bench/sort.bench.ts --iterations 500\n\n# Quick benchmark an expression\nbenchrun --eval \"JSON.parse(JSON.stringify({a:1}))\" --name \"roundtrip\"\n\n# JSON output for CI\nbenchrun bench/*.bench.ts --format json\n\n# Markdown for docs\nbenchrun bench/*.bench.ts --format markdown\n```\n\n### Benchmark file format\n\n```typescript\n// bench/sort.bench.ts\nexport default [\n  { name: 'Array.sort', fn: () =\u003e [3,1,2].sort() },\n  { name: 'spread sort', fn: () =\u003e [...[3,1,2]].sort() },\n];\n```\n\n## API\n\n### `suite(name?)`\n\nCreate a suite builder.\n\n```typescript\nsuite('my suite')\n  .add('case 1', () =\u003e { /* ... */ })\n  .addWithLifecycle({\n    name: 'case 2',\n    fn: () =\u003e { /* ... */ },\n    setup: () =\u003e { /* runs before each iteration */ },\n    teardown: () =\u003e { /* runs after each iteration */ },\n  })\n  .build(); // → BenchmarkCase[]\n```\n\n### `runSuite(cases, name?, options?)`\n\nRun all cases and return a `SuiteResult`.\n\nOptions:\n- `iterations` — per case (default: 100)\n- `warmup` — warmup iterations, not measured (default: 10)\n- `maxTime` — max time per case in ms (default: 10000)\n- `iterTimeout` — bail if a single iteration exceeds this (default: 5000)\n\n### `runCase(bench, options?)`\n\nRun a single case, returns `BenchmarkResult`.\n\n### `bench(cases, options?)`\n\nConvenience: run + format in one call. Returns a string.\n\n### `formatResult(result, format)`\n\nFormat a `SuiteResult` as `text`, `json`, or `markdown`.\n\n## Stats Explained\n\nEvery case gets:\n- **mean/median/min/max** — central tendency\n- **p95/p99** — tail latency\n- **stddev** — spread\n- **ops/sec** — throughput\n- **margin of error** — 95% confidence interval relative to mean (lower = more reliable)\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsulthonzh%2Fbenchrun","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsulthonzh%2Fbenchrun","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsulthonzh%2Fbenchrun/lists"}