skillaug/benchmark

优秀的性能需要基准测试

安装: 890

依赖: 0

建议者: 0

安全性: 0

星标: 5

关注者: 1

分支: 0

开放问题: 0

类型:php

v1.0.0 2018-10-12 07:55 UTC

This package is auto-updated.

Last update: 2024-09-14 14:55:42 UTC


README

通过基准测试找到最佳解决方案

安装

composer require --dev skillaug/benchmark "~1.0.0"

用法

基础

\skillaug\Benchmark::begin();

// your codes for benchmark here

\skillaug\Benchmark::end();

示例结果

Time:                     74 Mili second(s)
Memory_get_usage:         26 Megabyte(s)
Memory_get_peak_usage:    25.961 Megabyte(s)

带有单元选项

\skillaug\Benchmark::begin([
    'time' => 's', // second(s)
    'memory' => 'kb', // kilobyte(s)
]);

示例结果

Time:                     0.0759 Second(s)
Memory_get_usage:         26624.06 Kilobyte(s)
Memory_get_peak_usage:    26584.53 Kilobyte(s)

许可

BSD 3-Clause "新"或"修订"许可证。