A micro PHP library for benchmarking code execution time and memory usage.
Ubench is a micro PHP library for benchmarking code performance. It allows developers to measure execution time and memory usage of specific code blocks, helping identify optimization opportunities in PHP applications.
PHP developers who need to profile and optimize their code's performance, particularly those working on applications where execution speed and memory efficiency are critical.
Developers choose Ubench for its simplicity, lightweight design, and straightforward API that makes performance benchmarking accessible without complex setup or external dependencies.
Micro PHP benchmark library
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Ubench has no external dependencies, making it easy to drop into any PHP project without bloating the codebase, as emphasized in its minimalism philosophy.
Provides clear methods like start(), end(), and run() for callables, allowing developers to quickly measure performance with minimal code changes, as shown in the usage examples.
Supports printf-style patterns for customizing time and memory results, enabling display in various units like milliseconds or megabytes, as detailed in getTime() and getMemoryPeak() options.
The run() method automatically wraps any callable with start and end timing, simplifying the benchmarking of functions with parameters, as demonstrated in the README code snippet.
Only measures elapsed time and memory usage, lacking support for CPU usage, I/O statistics, or other advanced profiling metrics that comprehensive tools offer.
Requires explicit insertion of start() and end() calls in code, which can be intrusive and error-prone compared to automatic profilers that hook into the PHP runtime.
Provides single-run measurements without features for averaging multiple executions or calculating variance, making it less reliable for performance regression testing.