sebastian / foal
Tool to find lines eliminated by OpCache's bytecode optimizer
Fund package maintenance!
sebastianbergmann
Installs: 25
Dependents: 0
Suggesters: 0
Security: 0
Stars: 141
Watchers: 14
Forks: 1
Open Issues: 2
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-11-28 05:41:33 UTC
README
Find Optimized-Away Lines (FOAL)
foal
finds lines of code that are eliminated by OpCache's bytecode optimizer.
Installation
The recommended way to use this tool is a PHP Archive (PHAR):
$ wget https://phar.phpunit.de/foal.phar $ php foal.phar --version
Furthermore, it is recommended to use Phive for installing and updating the tool dependencies of your project.
Usage
example.php
<?php declare(strict_types=1); function f() { $result = 'result'; return $result; }
Default Output
$ 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 }
Lines prefixed with -
were optimized away by the OpCache bytecode optimizer.
Graph Output
$ 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