{"id":17124611,"url":"https://github.com/asika32764/php-simple-benchmark","last_synced_at":"2025-04-13T06:11:45.018Z","repository":{"id":33229358,"uuid":"36872999","full_name":"asika32764/php-simple-benchmark","owner":"asika32764","description":"PHP Simple Benchmark framework","archived":false,"fork":false,"pushed_at":"2023-10-28T12:48:37.000Z","size":27,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-13T06:11:32.685Z","etag":null,"topics":["benchmark","benchmark-framework","php"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/asika/simple-benchmark","language":"PHP","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/asika32764.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}},"created_at":"2015-06-04T13:49:15.000Z","updated_at":"2022-10-01T08:30:03.000Z","dependencies_parsed_at":"2022-06-27T10:24:07.101Z","dependency_job_id":null,"html_url":"https://github.com/asika32764/php-simple-benchmark","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asika32764%2Fphp-simple-benchmark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asika32764%2Fphp-simple-benchmark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asika32764%2Fphp-simple-benchmark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asika32764%2Fphp-simple-benchmark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/asika32764","download_url":"https://codeload.github.com/asika32764/php-simple-benchmark/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248670434,"owners_count":21142904,"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":["benchmark","benchmark-framework","php"],"created_at":"2024-10-14T18:43:00.285Z","updated_at":"2025-04-13T06:11:45.000Z","avatar_url":"https://github.com/asika32764.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP Simple Benchmark CLI\n\n## Installation via Composer\n\n``` bash\ncomposer global require asika/simple-benchmark\n```\n\n## Getting Started\n\nType `benchmark` or `sb` in terminal.\n\n``` bash\nsb\n```\n\nThe output will be:\n\n```\nPHP Simple Benchmark Framework - version: 2.0.0-beta\n------------------------------------------------------------\n\n[sb Help]\n\nHelp of Simple Benchmark.\n\nUsage:\n  sb \u003ccommand\u003e [option]\n\n\nOptions:\n\n  -h | --help       Display this help message.\n  -q | --quiet      Do not output any message.\n  -v | --verbose    Increase the verbosity of messages.\n  --ansi            Set 'off' to suppress ANSI colors on unsupported terminals.\n\nCommands:\n\n  run       Run benchmark\n  create    Create a task file.\n\nUse `benchmark create TaskName` to generate a new task sample file to /tasks folder.\n\nUse `benchmark run TaskFile.php [times]` to run benchmark\n```\n\n### Create a Task File\n\n```bash\nsb create TaskName\n```\n\nA file named `TaskName.php` will be generated to current folder.\n\nOpen `TaskName.php` you will see:\n\n```php\n\u003c?php\n\n/** @var \\SimpleBenchmark\\Benchmark $benchmark */\n\n```\n\nYou can do your benchmark by `addTask()`.\n \n```php\n\u003c?php\n\n/** @var \\SimpleBenchmark\\Benchmark $benchmark */\n$benchmark-\u003eaddTask('task1-md5', function() {\n    md5(uniqid());\n});\n\n$benchmark-\u003eaddTask('task2-sha1', function() {\n    sha1(uniqid());\n});\n```\n\n### Run Benchmark\n\nRun benchmark by this command:\n\n``` bash\nsb run TaskName.php\n```\n\nThe output will be:\n\n```\nBenchmark Result\n---------------------------------------------\nRun 10,000 times\n\ntask1-md5:\n  - Time: 0.0104s\n  - Memory: 2048kb\n\ntask2-sha1:\n  - Time: 0.0101s\n  - Memory: 2048kb\n\n```\n\nYou can set times (Default is 10000) at second argument:\n\n``` bash\nphp benchmark run TaskName.php 15000\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasika32764%2Fphp-simple-benchmark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasika32764%2Fphp-simple-benchmark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasika32764%2Fphp-simple-benchmark/lists"}