matraux/php-benchmark 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

matraux/php-benchmark

最新稳定版本:1.3.0

Composer 安装命令:

composer require matraux/php-benchmark

包简介

Benchmarking tool for PHP 8.4+ to measure code performance with accurate time and memory profiling.

README 文档

README

Latest Version on Packagist Last release License: MIT PHP Security Policy Contributing QA Status Issues Last Commit


Introduction

Simple and precise benchmarking for PHP 8.4+. Measures execution time and memory usage of code blocks with minimal overhead.


Features

  • High-precision time and memory measurement
  • Clean and readable syntax for benchmarking code blocks
  • Support for named measurements and grouped runs
  • Easy integration via callable or closure wrapping
  • Fluent API for accessing results
  • Minimal overhead, suitable for micro-benchmarking
  • Native support for PHP 8.4+ features
  • Integrates with Tracy for real-time benchmark visualization

Installation

composer require matraux/php-benchmark

Requirements

version PHP Note
1.0.7 8.3+ Initial commit
1.1.0 8.4+ Property access, performance optimizations
1.1.1 8.4+ Bugfixes and formatting improvements
1.2.0 8.4+ Integrations into Bridge/Tracy
1.3.0 8.4+ Added Symfony Console integration

Examples

See Tracy, Standalone or Console integration for advanced instructions.

use Matraux\PhpBenchmark\Benchmark\Benchmark;

$benchmark = Benchmark::create();
$benchmark->label = 'Memory peak 20 MB';
$benchmark->counter = 10;
$benchmark->multiplier = 2;

$measurement = $benchmark->run(function (): string {
	return str_repeat(' ', 20 * 1024 * 1024);
});

echo $measurement->average; // Print average time (e.g. 44 ms)
echo $measurement->memory; // Print peak memory usage (e.g. 22 MB)

Development

See Development for debug, test instructions, static analysis, and coding standards.


Support

For bug reports and feature requests, please use the issue tracker.

统计信息

  • 总下载量: 15
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2025-07-25