{"id":18808646,"url":"https://github.com/michaelostermann/tinybench-pretty-printer","last_synced_at":"2026-02-14T22:02:54.876Z","repository":{"id":242240882,"uuid":"802173647","full_name":"MichaelOstermann/tinybench-pretty-printer","owner":"MichaelOstermann","description":"🔎 Customizable pretty-printer for tinybench benchmarks","archived":false,"fork":false,"pushed_at":"2025-12-30T14:47:59.000Z","size":341,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-03T08:35:39.853Z","etag":null,"topics":["benchmark","cli","cli-table","markdown","pretty-print","tables","terminal","terminal-table","tinybench","tty-table"],"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/MichaelOstermann.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2024-05-17T16:58:36.000Z","updated_at":"2025-12-22T12:37:28.000Z","dependencies_parsed_at":"2025-12-31T01:07:01.345Z","dependency_job_id":null,"html_url":"https://github.com/MichaelOstermann/tinybench-pretty-printer","commit_stats":null,"previous_names":["michaelostermann/tinybench-pretty-printer"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/MichaelOstermann/tinybench-pretty-printer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MichaelOstermann%2Ftinybench-pretty-printer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MichaelOstermann%2Ftinybench-pretty-printer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MichaelOstermann%2Ftinybench-pretty-printer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MichaelOstermann%2Ftinybench-pretty-printer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MichaelOstermann","download_url":"https://codeload.github.com/MichaelOstermann/tinybench-pretty-printer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MichaelOstermann%2Ftinybench-pretty-printer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29457793,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T21:29:27.764Z","status":"ssl_error","status_checked_at":"2026-02-14T21:28:11.111Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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","cli-table","markdown","pretty-print","tables","terminal","terminal-table","tinybench","tty-table"],"created_at":"2024-11-07T23:13:40.235Z","updated_at":"2026-02-14T22:02:54.871Z","avatar_url":"https://github.com/MichaelOstermann.png","language":"TypeScript","readme":"\u003cdiv align=\"center\"\u003e\n\n\u003ch1\u003etinybench-pretty-printer\u003c/h1\u003e\n\n**🔎 Customizable pretty-printer for [tinybench](https://github.com/tinylibs/tinybench) benchmarks**\n\n![Minified](https://img.shields.io/badge/Minified-30.73_KB-blue)\n![Minzipped](https://img.shields.io/badge/Minzipped-10.53_KB-blue)\n\n\u003c/div\u003e\n\n![Example](./docs/screenshots/example.png)\n\n# Features\n\n- Output for CLIs and markdown\n- Build your own columns\n- Change column order\n- Handles unicode \u0026 truncation\n- Customizable count formatting:\n    - `none`\n    - `shortest`\n    - `highest`\n    - `lowest`\n    - `mean`\n    - `thousands`\n    - `millions`\n    - `billions`\n- Customizable duration formatting:\n    - `shortest`\n    - `highest`\n    - `lowest`\n    - `mean`\n    - `nanoseconds`\n    - `microseconds`\n    - `milliseconds`\n    - `seconds`\n- Sorting:\n    - `false`\n    - `asc`\n    - `desc`\n    - `Function`\n- Uses `Intl.NumberFormat` for localization and removing insignificant fractions\n- Customizable header titles, styles and alignments\n- Customizable row styles and alignments\n- Customizable borders and border styles\n- …\n\n# Installation\n\n```sh\nnpm install @monstermann/tinybench-pretty-printer\nyarn add @monstermann/tinybench-pretty-printer\npnpm add @monstermann/tinybench-pretty-printer\n```\n\n# Getting Started\n\n```ts\nimport { Bench } from \"tinybench\";\n\nconst bench = new Bench();\n\nbench.add(Function);\nbench.add(Function);\nbench.add(Function);\n\nawait bench.run();\n```\n\n**Using Defaults**\n\n```ts\nimport { tinybenchPrinter } from \"@monstermann/tinybench-pretty-printer\";\n\nconst cli = tinybenchPrinter.toCli(bench);\nconsole.log(cli);\n```\n\n```ts\nimport { writeFile } from \"node:fs/promises\";\n\nconst markdown = tinybenchPrinter.toMarkdown(bench);\nawait writeFile(\"results.md\", markdown);\n```\n\n**Using Options**\n\n```ts\nimport { tinybenchPrinter } from \"@monstermann/tinybench-pretty-printer\";\n\nconst myCustomPrinter = tinybenchPrinter\n\n    // Display ops/sec in millions exclusively:\n    .ops({ method: \"millions\" })\n\n    // Pick a time formatting method based on the mean duration of all benchmarks,\n    // and tweak some styling for that column:\n    .time({\n        method: \"mean\",\n        rowAlignment: [\"center\"],\n        rowStyle: [\"bold\"],\n    })\n\n    // Sort ascending instead of descending:\n    .sort(\"asc\")\n\n    // Decrease the default padding:\n    .padding(1)\n\n    // Remove some borders to make it more compact:\n    .useBorderTop(false)\n    .useBorderLeft(false)\n    .useBorderRight(false)\n    .useBorderBottom(false);\n\nconsole.log(myCustomPrinter.toCli(bench));\n```\n\n## Configuring Default Columns\n\n```ts\nimport { tinybenchPrinter } from \"@monstermann/tinybench-pretty-printer\";\n\ntinybenchPrinter\n\n    .name({\n        // Change the header title:\n        header: \"name\",\n        // Change the header style:\n        // (see https://github.com/alexeyraspopov/picocolors/blob/main/types.ts)\n        headerStyle: [\"bold\"],\n        // Change the header alignment: (left | center | right)\n        headerAlignment: \"center\",\n\n        // Change the row alignment: (left | center | right)\n        rowAlignment: \"left\",\n        // Change the row style:\n        // (see https://github.com/alexeyraspopov/picocolors/blob/main/types.ts)\n        rowStyle: [],\n    })\n\n    .summary({\n        // Change the column text of the fastest result:\n        fastestTitle: \"🥇\",\n\n        // Display as \"10x slower\":\n        method: \"x\",\n        // Display as \"-90%\":\n        method: \"%\",\n\n        // Change the header title:\n        header: \"summary\",\n        // Change the header style:\n        // (see https://github.com/alexeyraspopov/picocolors/blob/main/types.ts)\n        headerStyle: [\"bold\"],\n        // Change the header alignment: (left | center | right)\n        headerAlignment: \"center\",\n\n        // Change the row alignment: (left | center | right)\n        rowAlignment: \"center\",\n        // Change the row style:\n        // (see https://github.com/alexeyraspopov/picocolors/blob/main/types.ts)\n        rowStyle: [],\n    })\n\n    .ops({\n        // Display value as-is:\n        method: \"none\",\n        // Display all rows in thousands, eg. \"10K\":\n        method: \"thousands\",\n        // Display all rows in millions, eg. \"10M\":\n        method: \"millions\",\n        // Display all rows in billions, eg. \"10B\"\n        method: \"billions\",\n\n        // Choose from the above, favoring the shortest possible option for each row:\n        method: \"shortest\",\n        // Chose from the above, based on the highest ops/sec of all benchmarks:\n        method: \"highest\",\n        // Chose from the above, based on the lowest ops/sec of all benchmarks:\n        method: \"lowest\",\n        // Chose from the above, based on the mean ops/sec of all benchmarks:\n        method: \"mean\",\n\n        // Change the header title:\n        header: \"ops/sec\",\n        // Change the header style:\n        // (see https://github.com/alexeyraspopov/picocolors/blob/main/types.ts)\n        headerStyle: [\"bold\"],\n        // Change the header alignment: (left | center | right)\n        headerAlignment: \"center\",\n\n        // Change the row alignment: (left | center | right)\n        rowAlignment: \"right\",\n        // Change the row style:\n        // (see https://github.com/alexeyraspopov/picocolors/blob/main/types.ts)\n        rowStyle: [\"blue\"],\n    })\n\n    .time({\n        // Display all rows in nanoseconds, eg. \"10ns\":\n        method: \"nanoseconds\",\n        // Display all rows in microseconds, eg. \"10µs\":\n        method: \"microseconds\",\n        // Display all rows in milliseconds, eg. \"10ms\":\n        method: \"milliseconds\",\n        // Display all rows in seconds, eg. \"10s\":\n        method: \"seconds\",\n\n        // Choose from the above, favoring the shortest possible option for each row:\n        method: \"shortest\",\n        // Chose from the above, based on the highest time/op of all benchmarks:\n        method: \"highest\",\n        // Chose from the above, based on the lowest time/op of all benchmarks:\n        method: \"lowest\",\n        // Chose from the above, based on the mean time/op of all benchmarks:\n        method: \"mean\",\n\n        // Change the header title:\n        header: \"time/op\",\n        // Change the header style:\n        // (see https://github.com/alexeyraspopov/picocolors/blob/main/types.ts)\n        headerStyle: [\"bold\"],\n        // Change the header alignment: (left | center | right)\n        headerAlignment: \"center\",\n\n        // Change the row alignment: (left | center | right)\n        rowAlignment: \"right\",\n        // Change the row style:\n        // (see https://github.com/alexeyraspopov/picocolors/blob/main/types.ts)\n        rowStyle: [\"yellow\"],\n    })\n\n    .margin({\n        // Change the header title:\n        header: \"margin\",\n        // Change the header style:\n        // (see https://github.com/alexeyraspopov/picocolors/blob/main/types.ts)\n        headerStyle: [\"bold\"],\n        // Change the header alignment: (left | center | right)\n        headerAlignment: \"center\",\n\n        // Change the row alignment: (left | center | right)\n        rowAlignment: \"center\",\n        // Change the row style:\n        // (see https://github.com/alexeyraspopov/picocolors/blob/main/types.ts)\n        rowStyle: [\"magenta\"],\n    })\n\n    .samples({\n        // Display value as-is:\n        method: \"none\",\n        // Display all rows in thousands, eg. \"10K\":\n        method: \"thousands\",\n        // Display all rows in millions, eg. \"10M\":\n        method: \"millions\",\n        // Display all rows in billions, eg. \"10B\"\n        method: \"billions\",\n\n        // Choose from the above, favoring the shortest possible option for each row:\n        method: \"shortest\",\n        // Chose from the above, based on the highest ops/sec of all benchmarks:\n        method: \"highest\",\n        // Chose from the above, based on the lowest ops/sec of all benchmarks:\n        method: \"lowest\",\n        // Chose from the above, based on the mean ops/sec of all benchmarks:\n        method: \"mean\",\n\n        // Change the header title:\n        header: \"samples\",\n        // Change the header style:\n        // (see https://github.com/alexeyraspopov/picocolors/blob/main/types.ts)\n        headerStyle: [\"bold\"],\n        // Change the header alignment: (left | center | right)\n        headerAlignment: \"center\",\n\n        // Change the row alignment: (left | center | right)\n        rowAlignment: \"right\",\n        // Change the row style:\n        // (see https://github.com/alexeyraspopov/picocolors/blob/main/types.ts)\n        rowStyle: [\"magenta\"],\n    });\n```\n\n## Adding Custom Columns\n\n\u003e [!NOTE]\n\u003e You can also use this to overwrite the default columns!\n\n```ts\nimport { tinybenchPrinter } from \"@monstermann/tinybench-pretty-printer\";\n\ntinybenchPrinter\n\n    .column(\"my-custom-column\", {\n        // Return the string that should be displayed in each row:\n        content({\n            task,\n            tasks,\n            fastestTask,\n            slowestTask,\n            locales,\n            formatNumber,\n            formatDuration,\n            formatCount,\n        }) {\n            return String(task.result.hz);\n        },\n\n        // Set the header title:\n        header: \"ops/sec\",\n        // Set the header style:\n        // (see https://github.com/alexeyraspopov/picocolors/blob/main/types.ts)\n        headerStyle: [\"bold\"],\n        // Set the header alignment: (left | center | right)\n        headerAlignment: \"center\",\n        // Set the row alignment: (left | center | right)\n        rowAlignment: \"right\",\n        // Set the row style:\n        // (see https://github.com/alexeyraspopov/picocolors/blob/main/types.ts)\n        rowStyle: [\"blue\"],\n    })\n\n    // After you set up your columns, you need to define which columns to display,\n    // in what order:\n    .order([\"name\", \"summary\", \"my-custom-column\"]);\n```\n\n## Rendering Options\n\n```ts\nimport { tinybenchPrinter } from \"@monstermann/tinybench-pretty-printer\";\n\ntinybenchPrinter\n\n    // Change the order of the columns and/or drop unwanted ones:\n    .order([\"name\", \"ops\"])\n\n    // Change the sorting method used:\n    .sort(false)\n    .sort(\"asc\")\n    .sort(\"desc\")\n    .sort((tasks) =\u003e tasks)\n\n    // Change the locales passed to Number.toLocaleString:\n    .locales(\"en-US\")\n\n    // Change the NodeJS.WriteStream that is used to detect the maximum available width:\n    .stdout(process.stdout)\n    // Force a custom max-width:\n    .maxWidth(undefined)\n\n    // Change the padding between columns:\n    .padding(2)\n\n    // Customize which borders should be used:\n    .useHeader(true)\n    .useTopBorder(true)\n    .useBottomBorder(true)\n    .useLeftBorder(true)\n    .useRightBorder(true)\n    .useDividerBorder(true)\n    .useHeaderSeparator(true)\n    .useRowSeparator(false)\n\n    // Change the style of all borders:\n    // (see https://github.com/alexeyraspopov/picocolors/blob/main/types.ts)\n    .borderStyle([\"dim\"])\n\n    // Customize the borders:\n    .borders({\n        top: \"─\",\n        topLeft: \"┌\",\n        topRight: \"┐\",\n        topDivider: \"┬\",\n\n        bottom: \"─\",\n        bottomLeft: \"└\",\n        bottomRight: \"┘\",\n        bottomDivider: \"┴\",\n\n        left: \"│\",\n        right: \"│\",\n        divider: \"│\",\n\n        separator: \"─\",\n        separatorLeft: \"├\",\n        separatorRight: \"┤\",\n        separatorDivider: \"┼\",\n    });\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelostermann%2Ftinybench-pretty-printer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichaelostermann%2Ftinybench-pretty-printer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelostermann%2Ftinybench-pretty-printer/lists"}