{"id":14972140,"url":"https://github.com/hyperized/benchmark","last_synced_at":"2026-04-12T00:12:14.130Z","repository":{"id":49433676,"uuid":"119590899","full_name":"hyperized/benchmark","owner":"hyperized","description":"PHP Server benchmarking","archived":false,"fork":false,"pushed_at":"2024-06-24T04:44:28.000Z","size":52,"stargazers_count":16,"open_issues_count":14,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-31T21:52:54.532Z","etag":null,"topics":["benchmark","cpu","disk","mysql","mysqli","php","php7","server"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hyperized.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}},"created_at":"2018-01-30T20:32:55.000Z","updated_at":"2023-03-09T13:43:27.000Z","dependencies_parsed_at":"2022-09-24T03:31:36.711Z","dependency_job_id":null,"html_url":"https://github.com/hyperized/benchmark","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/hyperized%2Fbenchmark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperized%2Fbenchmark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperized%2Fbenchmark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperized%2Fbenchmark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hyperized","download_url":"https://codeload.github.com/hyperized/benchmark/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238375234,"owners_count":19461569,"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","cpu","disk","mysql","mysqli","php","php7","server"],"created_at":"2024-09-24T13:46:26.643Z","updated_at":"2026-04-12T00:12:14.123Z","avatar_url":"https://github.com/hyperized.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP benchmark\n\n[![CI](https://github.com/hyperized/benchmark/actions/workflows/ci.yml/badge.svg)](https://github.com/hyperized/benchmark/actions/workflows/ci.yml)\n\nComprehensive PHP server benchmarking utility. Tests your hosting environment across 15 benchmark modules and reports results in milliseconds.\n\nAuto-detects CLI vs web and renders with the appropriate output mode:\n- **CLI** — ANSI colors with Unicode box-drawing tables\n- **Web** — styled HTML dashboard with responsive CSS grid layout\n\nEach run saves a JSON report with a timestamp to `reports/`.\n\n## Benchmark Modules\n\n| Category | Module | What it measures |\n|----------|--------|-----------------|\n| **Environment** | PHP | Version, ini settings, memory limits, loaded extensions |\n| **I/O** | Disk I/O | File creation across 8 block sizes (512B–64KB) |\n| | File Read | Sequential reads across file sizes (1KB–4MB) |\n| | Network | DNS resolution and TCP connection latency |\n| **Compute** | CPU | Math functions, string operations, loops, conditionals |\n| | Memory | Allocation speed and peak memory per operation |\n| | Regex | `preg_match` and `preg_replace` across 10 pattern types |\n| | JSON | Encode/decode with small, medium, and large payloads |\n| | Serialization | `serialize` vs `json_encode` vs `var_export` (+ igbinary/msgpack if available) |\n| | Hashing | md5, sha1, sha256, sha512, xxh3, crc32, hmac-sha256, bcrypt, argon2id |\n| | Encryption | AES-128/256-CBC/GCM, ChaCha20-Poly1305 encrypt and decrypt |\n| | Compression | gzip, zlib, deflate (+ brotli/lzf if available) with compression ratios |\n| **Runtime** | Function Overhead | Named function, closure, first-class callable, static/instance method, arrow function |\n| | Type Casting | int/string/float/bool conversions |\n| | Object Instantiation | stdClass, DateTime, SplStack, SplPriorityQueue, ArrayObject |\n| **Database** | MySQL | Query performance (requires ext-mysqli) |\n\nAll modules can be individually enabled/disabled and configured in `config/config.yml`.\n\n## Requirements\n\n- PHP \u003e= 8.4\n- ext-mysqli (for MySQL benchmarks, optional)\n\n## Installation\n\n```bash\ncomposer create-project hyperized/benchmark\ncp config/config.yml.example config/config.yml\n```\n\nAdjust `config/config.yml` to your preferences. Set module toggles, cycle counts, MySQL credentials, and optionally override the output format.\n\n## Usage\n\n### CLI\n\n```bash\nphp benchmark.php\n```\n\nExample output:\n\n```\n╔════════════════════════════════════════════════╗\n║  PHP Benchmark Report                          ║\n║  2026-04-11 14:30:22                           ║\n╚════════════════════════════════════════════════╝\n\n── PHP ───────────────────────────────────────────\n\n  PHP Version     8.5.4\n  Server          CLI\n  Max Memory      128.00 MB\n  Max Upload      2.00 MB\n  Max Exec Time   0 seconds\n  Extensions      67 loaded\n\n── Disk I/O ──────────────────────────────────────\n\n  Cycles: 100\n  ms (lower is better)\n\n  ┌──────────┬──────────┬──────────┬──────────┐\n  │ 512.00 B │ 1.00 KB  │ 2.00 KB  │ 4.00 KB  │ ...\n  ├──────────┼──────────┼──────────┼──────────┤\n  │ 9.55ms   │ 9.78ms   │ 9.46ms   │ 10.97ms  │ ...\n  └──────────┴──────────┴──────────┴──────────┘\n\n── Hashing ───────────────────────────────────────\n\n  Hash Functions (99999 cycles, ms, lower is better)\n\n  ┌──────────┬──────────┬──────────┬──────────┬──────────┐\n  │ md5      │ sha1     │ sha256   │ sha512   │ xxh3     │ ...\n  ├──────────┼──────────┼──────────┼──────────┼──────────┤\n  │ 143.00ms │ 155.71ms │ 387.45ms │ 288.95ms │ 16.35ms  │ ...\n  └──────────┴──────────┴──────────┴──────────┴──────────┘\n\n  ...\n\n──────────────────────────────────────────────────\n  Total Duration  18.657s\n  Report saved    reports/2026-04-11_143022.json\n──────────────────────────────────────────────────\n```\n\n### Web\n\n```bash\nphp -S localhost:8000 benchmark.php\n```\n\nOpen `http://localhost:8000` for a styled HTML dashboard with cards for each module.\n\n### Remote\n\nInstall on the server via Composer and visit `/benchmark.php` in the browser.\n\n### Reports\n\nJSON reports are saved to `reports/` with timestamped filenames (e.g. `2026-04-11_143022.json`). Disable via `benchmark.output.report: false` in config.\n\n### Configuration\n\nAll modules support `enabled: true/false` and configurable cycle counts:\n\n```yaml\nbenchmark:\n  output:\n    format: ~        # null = auto-detect, 'cli', or 'html'\n    report: true     # save JSON report to reports/\n  php:\n    enabled: true\n  disk:\n    enabled: true\n    cycles: 100\n  memory:\n    enabled: true\n    count: 9999\n  network:\n    enabled: true\n    cycles: 3\n    hosts:\n      - google.com\n      - cloudflare.com\n      - github.com\n  hashing:\n    enabled: true\n    hashCount: 99999\n    passwordCount: 10\n  # ... see config/config.yml.example for all options\n```\n\n### Security\n\nIf deploying to a web server, ensure `config.yml` is not publicly accessible. For Apache with `mod_rewrite`:\n\n```apache\n\u003cFiles \"config.yml\"\u003e\n    deny from all\n\u003c/Files\u003e\n```\n\n## Development\n\n```bash\ncomposer analyse    # Run PHPStan (level 8)\ncomposer cs-fix     # Auto-fix code style (PER-CS2.0)\ncomposer cs-check   # Check code style (dry run)\n```\n\n## Contribution\n\nI'm open to improvements and new benchmarks via [pull requests](https://github.com/hyperized/benchmark/pulls).\n\nIssues can be reported through [Issues](https://github.com/hyperized/benchmark/issues).\nPlease include the full output of the script and your config file without the password.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperized%2Fbenchmark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhyperized%2Fbenchmark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperized%2Fbenchmark/lists"}