{"id":19557325,"url":"https://github.com/andrefs/mtc-bench","last_synced_at":"2026-05-06T09:42:30.207Z","repository":{"id":261680516,"uuid":"885011583","full_name":"andrefs/mtc-bench","owner":"andrefs","description":"Benchmark commands using hyperfine and psrecord. Look into CPU, memory and time.","archived":false,"fork":false,"pushed_at":"2024-11-13T10:28:06.000Z","size":519,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-08T21:41:08.404Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Perl","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/andrefs.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}},"created_at":"2024-11-07T19:43:59.000Z","updated_at":"2024-11-13T10:28:11.000Z","dependencies_parsed_at":"2024-11-07T21:41:16.401Z","dependency_job_id":null,"html_url":"https://github.com/andrefs/mtc-bench","commit_stats":null,"previous_names":["andrefs/mtc-bench"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrefs%2Fmtc-bench","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrefs%2Fmtc-bench/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrefs%2Fmtc-bench/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrefs%2Fmtc-bench/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andrefs","download_url":"https://codeload.github.com/andrefs/mtc-bench/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240814864,"owners_count":19861957,"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":[],"created_at":"2024-11-11T04:41:48.661Z","updated_at":"2026-05-06T09:42:25.185Z","avatar_url":"https://github.com/andrefs.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mtc-bench\n\nBenchmark commands using `hyperfine` and `psrecord`. Look into CPU, memory and time.\n\n## Dependencies\n\n- hyperfine\n- psrecord\n\n## Installing\n\nRun the `install.sh` script to install `mtc-bench` on your `/usr/local/bin` directory.\n\nYou can use the `INSTALL_DIR` ENV var to install on another place, e.g.:\n\n```\nINSTALL_DIR=$HOME/.local/bin ./install.sh\n```\n\n## Rebuilding\n\nThe build process uses `App::Fatpacker` to bundle `mtc-bench.pl` together with it's dependencies and generate `mtc-bench`.\n\nIf you want to change stuff you should edit `mtc-bench.pl` and in the end run\n\n```\nfatpack pack mtc-bench.pl \u003e mtc-bench\n```\n\n## Run\n\n```bash\nmtc-bench 'CMD1 [ARGS...]' ['CMD2'...]\n```\n\nExample:\n\n```bash\nmtc-bench 'sleep 2' 'sleep 3'\n```\n\nAlternatively, you can pass a CSV file with commands to be run, using the flag `-f CMDS_FILE`. The file should have a header row, and then one command per line:\n\n```csv\nlabel, prepare, command\ncmdLabel1, , command1 arg1 arg2\ncmdLabel2, , command2\n```\n\n## Options\n\n- `-h, --help`: Print help message\n- `-v, --verbose`: Print verbose output\n- `-s, --show-output`: Show output of the commands\n- `-p, --prepare`: Prepare commands to run before benchmarking. See `hyperfine --help`\n- `-f, --file`: Read commands from a CSV file\n- `-d, --dry-run`: Just print the command that would be executed\n\n## ENV vars\n\nYou can also change the behavior of `mtc-bench` using the following ENV variables:\n\n- `WARMUP`: Number of warmup runs\n- `RES_DIR`: Directory to store results\n- `RUNS`: Number of runs\n\n## Performance\n\nIn `mtc-bench`, `hyperfine` invokes `psrecord`, which in turn invokes the command to be benchmarked.\nThis means that `hyperfine` is not directly measuring the command's run time, but `psrecord`'s instead.\n\nI ran a few tests on my laptop and `psrecord` seems to add around 0.7s to the command's run time in each run (probably because it is generating the output log and image).\nAnyway, it shouldn't change much across runs, so the comparisons between the commands being benchmarked still stand.\n\n## Bugs and stuff\n\nOpen a GitHub [issue](https://github.com/andrefs/mtc-bench/issues) or, preferably, send me a [pull request](https://github.com/andrefs/mtc-bench/pulls).\n\n## License\n\nThe MIT License (MIT)\n\nCopyright (c) 2024 André Santos andrefs@andrefs.com\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrefs%2Fmtc-bench","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrefs%2Fmtc-bench","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrefs%2Fmtc-bench/lists"}