sebastian / foal
查找由OpCache的字节码优化器消除的行
0.3.0
2024-03-24 15:13 UTC
Requires
- php: ^8.3
- ext-vld: *
- ext-zend-opcache: *
- phpunit/php-file-iterator: ^5.0
- sebastian/cli-parser: ^3.0
- sebastian/diff: ^6.0
- sebastian/version: ^5.0
This package is auto-updated.
Last update: 2024-08-28 05:06:38 UTC
README
查找被优化的行(FOAL)
foal
可以找到被 OpCache 字节码优化器消除的代码行。
安装
推荐使用 PHP 归档 (PHAR) 来使用此工具
$ wget https://phar.phpunit.de/foal.phar $ php foal.phar --version
此外,还推荐使用 Phive 来安装和更新项目的工具依赖
用法
example.php
<?php declare(strict_types=1); function f() { $result = 'result'; return $result; }
默认输出
$ php foal.phar example.php
foal 0.4.0 by Sebastian Bergmann.
1 <?php declare(strict_types=1);
2 function f()
3 {
- 4 $result = 'result';
5
6 return $result;
- 7 }
以 -
开头的行已被 OpCache 字节码优化器优化消除。
图形输出
$ php foal.phar --paths example example/source.php
foal 0.4.0 by Sebastian Bergmann.
Wrote execution paths for example/source.php to example/unoptimized.dot
Wrote optimized execution paths for example/source.php to example/optimized.dot
$ dot -Tsvg -o example/unoptimized.svg example/unoptimized.dot
$ dot -Tsvg -o example/optimized.svg example/optimized.dot