承接 hhpack/performance 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

hhpack/performance

Composer 安装命令:

composer require hhpack/performance

包简介

Performance utility library for Hack

README 文档

README

Latest Stable Version Build Status Dependency Status License

Screen Shot

Basic usage

You can measure the time of easy processing.

use HHPack\Performance\PerformanceWatcher;
use HHPack\Performance\TimeWatcher;
use HHPack\Performance\MemoryWatcher;
use HHPack\Performance\Result\WatchedResult;

$watcher = PerformanceWatcher::fromItems([
    Pair { 'time', new TimeWatcher() },
    Pair { 'memory', new MemoryWatcher() }
]);

$watcher->start();
$watcher->stop();

$texts = $watcher->result()->mapWithKey(($key, $result) ==> {
    return sprintf("%s: %s", $key, (string) $result->value());
})->values();

foreach ($texts as $text) {
    echo $text, PHP_EOL;
}

Benchmark

use HHPack\Performance as bench;

function sync_benchmarker() : void
{
    bench\sync()->times(10)->run(() ==> {
        usleep(2000);
    });
}
sync_benchmarker();

or

use HHPack\Performance as bench;

async function async_benchmarker_main() : Awaitable<void>
{
    await bench\async()->times(10)->run(async () ==> {
        await \HH\Asio\usleep(2000);
    });
}

\HH\Asio\join(async_benchmarker_main());

Run the test

You can run the test with the following command.

composer install
composer test

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 0
  • Forks: 0
  • 开发语言: Hack

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-01-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固