{"id":13622971,"url":"https://github.com/devster/ubench","last_synced_at":"2025-05-15T11:06:22.788Z","repository":{"id":5713254,"uuid":"6924333","full_name":"devster/ubench","owner":"devster","description":"Micro PHP benchmark library","archived":false,"fork":false,"pushed_at":"2023-09-14T07:50:50.000Z","size":22,"stargazers_count":565,"open_issues_count":3,"forks_count":71,"subscribers_count":27,"default_branch":"master","last_synced_at":"2025-04-15T00:52:37.922Z","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/devster.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":"2012-11-29T16:15:41.000Z","updated_at":"2025-02-11T16:26:22.000Z","dependencies_parsed_at":"2024-06-18T11:07:50.264Z","dependency_job_id":"fb35e40a-3bcd-4cc8-a695-be4dc2c98a60","html_url":"https://github.com/devster/ubench","commit_stats":{"total_commits":22,"total_committers":6,"mean_commits":"3.6666666666666665","dds":0.5454545454545454,"last_synced_commit":"9f593759af88ef2a584ff6ca8bc0e7d76256fcaf"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devster%2Fubench","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devster%2Fubench/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devster%2Fubench/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devster%2Fubench/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devster","download_url":"https://codeload.github.com/devster/ubench/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254328385,"owners_count":22052632,"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-08-01T21:01:26.443Z","updated_at":"2025-05-15T11:06:22.765Z","avatar_url":"https://github.com/devster.png","language":"PHP","readme":"Ubench [![Build Status](https://travis-ci.org/devster/ubench.svg?branch=master)](https://travis-ci.org/devster/ubench)\n======\n\nUbench is a PHP micro library for benchmark\n\nInstallation\n------------\n\nNote: If you are looking for this package for laravel application then install it from here [Benchmark](https://packagist.org/packages/asad/benchmark)\n\n### Old school ###\n\nrequire `src/Ubench.php` in your project.\n\n### Composer ###\n\nAdd this to your composer.json\n\n```json\n{\n    \"require\": {\n        \"devster/ubench\": \"~2.0.0\"\n    }\n}\n```\n\nUsage\n-----\n\n```php\nrequire_once 'src/Ubench.php';\n\n$bench = new Ubench;\n\n$bench-\u003estart();\n\n// Execute some code\n\n$bench-\u003eend();\n\n// Get elapsed time and memory\necho $bench-\u003egetTime(); // 156ms or 1.123s\necho $bench-\u003egetTime(true); // elapsed microtime in float\necho $bench-\u003egetTime(false, '%d%s'); // 156ms or 1s\n\necho $bench-\u003egetMemoryPeak(); // 152B or 90.00Kb or 15.23Mb\necho $bench-\u003egetMemoryPeak(true); // memory peak in bytes\necho $bench-\u003egetMemoryPeak(false, '%.3f%s'); // 152B or 90.152Kb or 15.234Mb\n\n// Returns the memory usage at the end mark\necho $bench-\u003egetMemoryUsage(); // 152B or 90.00Kb or 15.23Mb\n\n// Runs `Ubench::start()` and `Ubench::end()` around a callable\n// Accepts a callable as the first parameter.  Any additional parameters will be passed to the callable.\n$result = $bench-\u003erun(function ($x) {\n    return $x;\n}, 1);\necho $bench-\u003egetTime();\n```\n\nLicense\n-------\n\nUbench is licensed under the MIT License\n","funding_links":[],"categories":["Code Analysis","代码分析","PHP","目录","Table of Contents","代码分析( Code Analysis )","类库","代码分析 Code Analysis"],"sub_categories":["代码分析 Code Analysis","Code Analysis","未归类"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevster%2Fubench","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevster%2Fubench","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevster%2Fubench/lists"}