{"id":15676837,"url":"https://github.com/jacobbednarz/php-bench","last_synced_at":"2025-05-07T00:30:17.251Z","repository":{"id":23386341,"uuid":"26747999","full_name":"jacobbednarz/php-bench","owner":"jacobbednarz","description":"Benchmarking PHP, the easy way","archived":false,"fork":false,"pushed_at":"2015-02-02T04:04:48.000Z","size":184,"stargazers_count":13,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-31T04:34:00.198Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/jacobbednarz.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":"2014-11-17T08:46:16.000Z","updated_at":"2022-08-25T23:33:50.000Z","dependencies_parsed_at":"2022-08-22T00:10:27.089Z","dependency_job_id":null,"html_url":"https://github.com/jacobbednarz/php-bench","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacobbednarz%2Fphp-bench","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacobbednarz%2Fphp-bench/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacobbednarz%2Fphp-bench/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacobbednarz%2Fphp-bench/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jacobbednarz","download_url":"https://codeload.github.com/jacobbednarz/php-bench/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252790897,"owners_count":21804675,"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-10-03T16:05:59.634Z","updated_at":"2025-05-07T00:30:17.200Z","avatar_url":"https://github.com/jacobbednarz.png","language":"PHP","readme":"# PHP Benchmark - The easy way\n\nThis is designed to make benchmarking PHP easy.\n\n### Installation\n\n```\ngit clone git@github.com:jacobbednarz/php-bench.git\n```\n\n### Usage\n\nTo run the benchmark, you need to include the class into a file and instantiate the class.\n\n```php\n\u003c?php\n\ninclude_once 'path/to/benchmark.php';\n\n$b = new Benchmark;\n```\n\nAfter that, you need to add the 'reports' and the methods you wish to benchmark.\n\n```php\n\u003c?php\n\ninclude_once 'path/to/benchmark.php';\n\n// Here are the methods we want to benchmark against each other.\nfunction my_method() {\n  return \"a\" . \"b\";\n}\n\nfunction my_method2() {\n  return \"a\" + \"b\";\n}\n\n$b = new Benchmark;\n$b-\u003ereport('foo', 'my_method');\n$b-\u003ereport('foo2', 'my_method2');\n$b-\u003ebench();\n```\n\nExpected output:\n\n```\n$ php benchmark.php\n\nIDENTIFIER    EXECUTION TIME    MEMORY USAGE\nfoo           0.00003099ms      128b\nfoo2          0.00000906ms      128b\n```\n\n### Set the iterations\n\nIf you need to perform more iterations than the default (10), you can use `setIterations()` to set the value.\n\n```php\n\u003c?php\n\ninclude_once 'path/to/benchmark.php';\n\n// Here are the methods we want to benchmark against each other.\nfunction my_method() {\n  return \"a\" . \"b\";\n}\n\nfunction my_method2() {\n  return \"a\" + \"b\";\n}\n\n$b = new Benchmark;\n$b-\u003esetIterations(1000);\n$b-\u003ereport('foo', 'my_method');\n$b-\u003ereport('foo2', 'my_method2');\n$b-\u003ebench();\n```\n","funding_links":[],"categories":["Benchmark - PHP"],"sub_categories":["Meetups"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacobbednarz%2Fphp-bench","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjacobbednarz%2Fphp-bench","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacobbednarz%2Fphp-bench/lists"}