{"id":30676111,"url":"https://github.com/ahwayakchih/pete","last_synced_at":"2026-01-20T16:55:26.269Z","repository":{"id":311982797,"uuid":"174703703","full_name":"ahwayakchih/pete","owner":"ahwayakchih","description":"PeTe: Performance Tester (benchmark runner) for Bun and Node.js","archived":false,"fork":false,"pushed_at":"2025-07-27T14:49:31.000Z","size":200,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-28T05:36:15.999Z","etag":null,"topics":["benchmarking","nodejs","performance-testing","testing"],"latest_commit_sha":null,"homepage":"https://ahwayakchih.github.io/pete/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ahwayakchih.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}},"created_at":"2019-03-09T14:21:46.000Z","updated_at":"2025-07-27T13:49:27.000Z","dependencies_parsed_at":"2025-08-28T05:36:22.627Z","dependency_job_id":"dd1d83c3-efe9-4a99-8f83-b7d3d4cc8aca","html_url":"https://github.com/ahwayakchih/pete","commit_stats":null,"previous_names":["ahwayakchih/pete"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ahwayakchih/pete","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahwayakchih%2Fpete","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahwayakchih%2Fpete/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahwayakchih%2Fpete/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahwayakchih%2Fpete/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ahwayakchih","download_url":"https://codeload.github.com/ahwayakchih/pete/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahwayakchih%2Fpete/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273100870,"owners_count":25045700,"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-09-01T02:00:09.058Z","response_time":120,"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":["benchmarking","nodejs","performance-testing","testing"],"created_at":"2025-09-01T09:41:49.297Z","updated_at":"2026-01-20T16:55:26.263Z","avatar_url":"https://github.com/ahwayakchih.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"PeTe\n=====\n\nPeTe is a performance tester, a benchmark runner for JavaScript functions (or whole scripts).\nCompatible with both [Node.js](https://nodejs.org/) and [Bun](https://bun.sh/).\n\nIt's primary goal is to make benchmarking as easy as possible. So, instead of creating its own specific (and overly complicated) API, it offers three simple functions that you might find incredibly similar to those you already know from simpler test modules (like [`tape`](https://github.com/ljharb/tape) or Node's built-in test-runner):\n\n- `test`: runs a function in two \"phases\" (\"warmup\" and \"regular\"),\n- `skip`: does not run the function at all, just marks result as skipped,\n- `todo`: runs function without \"warmup\" phase, marks result as \"todo\" and does not stop tests if it errors out.\n\nEach of them accepts the same number and type of parameters. They differ only by how the results are interpreted.\n\n- `name` of a test is optional, if not provided, PeTe will use benchmarked function's \"id\" (filename, line number),\n- `fn` is a required function that is to be benchmarked,\n- `options` is an optional object that may contain any of the [supported options](lib/RunOptions.js),\n- `cb` is an optional function to call after benchmarking of the `fn` function ends.\n\n## Installation\n\nTo install PeTe, as with most of the other Node.js modules, use following command line:\n\n```sh\nnpm install @ahwayakchih/pete\n```\n\nor install it globally:\n\n```sh\nnpm install -g @ahwayakchih/pete\n```\n\n## Usage (API)\n\nThe simplest possible way to run a test is:\n\n```js\nconst test = require('pete/test');\n\ntest(myCustomFunction);\n\n/**\n * This is the function that's being tested above.\n */\nfunction myCustomFunction () {\n  return \"done\";\n}\n```\n\nOf course you can pass any type of function to it. PeTe tries to automatically recognize if that function is synchronous (like in example above), \"callback\"-style (last of its params is called either: \"cb\", \"callback\", \"done\" or \"next\"), `async` or returns a Promise. If a string is passed in place of a function, PeTe will try to run forked process assuming that the string is a path to a script file.\n\nIf that fails for some reason, you can always enforce your choice by passing additional `runType` option:\n\n```js\nconst test = require('pete/test');\n\ntest(myCustomFunction, {\n  // @see: lib/runs/auto.js for current list of supported/\"built-in\" `runTypes`\n  runType: 'sync'\n});\n\nfunction myCustomFunction () {\n  return \"done\";\n}\n```\n\nYou can even create your own \"runner\" module. PeTe will first try its own runners, and if none is found with specified name, it will try to `require` module with that name (which means, that module should export a single function). Check how [`pete/lib/runs/skip`](lib/runs/skip.js) and other runners are implemented.\n\n## Usage (CLI)\n\nIf you installed PeTe globally, or you are trying to use it from your project's `package.json` script(s), you should be able to use it like this:\n\n```sh\npete test-file.js\n```\n\nIt supports following options:\n\n- *-c, --maxCpuTime*      : limit total time (in milliseconds) that target test can take when run multiple times\n- *-r, --maxRealTime*     : limit total time (in milliseconds) that a single test run can take\n- *-s, --maxSamples*      : limit how many times target function should be called when tested\n- *-w, --maxWarmup*       : same as `samples`, only for \"warmup\" phase of test run\n- *-p, --percentile*      : specify which percentiles you want reported\n- *-o, --output, --report*: specify reporter(s)\n- *-b, --bail*            : set to `false` (or use `-no` prefix: `--no-bail`) to continue to the next test, when one errors out\n- *-j, --just, --only*    : specify ID of the test you want to be run as the only one from the file(s)\n- *-a, --arg*             : optionally specify one or more arguments to be passed to tested function(s)\n\nYou can also pass a JSON file with previous report data, for example to \"convert\" it to another supported format:\n\n```sh\npete examples/index.js -o json?out=reports/examples.json\npete reports/examples.json -o tap\n```\n\nOf course, any test file that uses PeTe, can be run directly and supports same CLI options.\nFor example, to run test for maximum of 3 seconds and output results in [`TAP`](https://testanything.org/) format:\n\n```sh\nnode examples/example1.js --maxRealTime 3000 --report tap\n```\n\nOr same situation but using Bun:\n\n```sh\nbun --expose-gc examples/example1.js --maxRealTime 3000 --report tap\n```\n\nTo get results in a format that's a bit more readable for a common human, use `mico` reporter:\n\n```sh\nnode examples/example1.js --maxRealTime 3000 --report mico\n```\n\nThat will output something similar to:\n\n```txt\n   s name                         p99         max           ops           samples      *p99   \n  --------------------------------------------------------------------------------------------\n   ✔ sync1                     🕛  121ns    97,279ns   ~23,053,627/s   |11,252,924|   × 1.00  \n  🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜶘𜴦🮔\n   ✔ callback3                 🕐  130ns   122,623ns   ~21,624,682/s   |12,667,593|   × 1.07  \n  🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜶘𜶘𜴦🮔\n   ✔ generator1                🕐  140ns    32,351ns   ~16,652,797/s   | 9,625,101|   × 1.16  \n  🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜶘𜴦🮔🮔\n   ✔ async1                    🕗  220ns   166,015ns   ~ 7,103,987/s   | 7,584,502|   × 1.82  \n  🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂𜶘𜶘𜶘𜶘𜶘𜶘𜶘𜶘𜶘𜶘𜶘𜶘𜶘𜶘𜶘𜶘𜶘𜶘𜶘𜶘𜶫🮔🮔\n   ✗ callback1ToDo             Error: Intentional Test Error\n  🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔\n   ✗ callback2ToDoException    Error: Intentional Test Exception\n  🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔\n```\n\nTo keep the difference column (\"\\*p99\"), but without horizontal bars, use:\n\n```sh\nnode examples/example3.js -o 'mico?cols=status,name,p99,ops,samples,*p99\u0026sort=p99' --no-bail\n```\n\nThat will output something similar to:\n\n```txt\n   s name             p99           ops           samples      *p99   \n  --------------------------------------------------------------------\n   ✔ sync3         🕛  121ns   ~22,766,507/s   |11,043,876|   × 1.00  \n   ✔ callback3     🕐  130ns   ~21,984,471/s   |12,243,370|   × 1.07  \n   ✔ async3        🕘  231ns   ~ 6,471,422/s   | 7,071,764|   × 1.91  \n   ✗ sync3error    Error: Intentional Test Error\n```\n\nWith bar row:\n\n```sh\nnode examples/example3.js -o 'mico?cols=status,name,p99,ops,samples,*p99,=p99.95\u0026sort=p99' --no-bail\n```\n\nwill output something similar to:\n\n```txt\n   s name             p99           ops           samples      *p99   \n  --------------------------------------------------------------------\n   ✔ sync3         🕛  130ns   ~21,853,117/s   |10,993,846|   × 1.00  \n  🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜶘𜴦🮔\n   ✔ callback3     🕛  130ns   ~21,662,141/s   |11,708,079|   × 1.00  \n  🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴦🮔\n   ✔ async3        🕗  231ns   ~ 6,457,818/s   | 7,105,622|   × 1.78  \n  🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂🮂𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜴢𜶘𜶘𜶫🮔🮔\n   ✗ sync3error    Error: Intentional Test Error\n  🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔🮔\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahwayakchih%2Fpete","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fahwayakchih%2Fpete","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahwayakchih%2Fpete/lists"}