Last active October 28, 2021 07:57
Save nikic/289b0c7538b46c2220bc to your computer and use it in GitHub Desktop.
Scripts for measuring compile time
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters <?php ini_set('memory_limit', -1); if ($argc != 3) die("error\n"); $file = $argv[1]; $num = $argv[2]; $startTime = microtime(true); for ($i = 0; $i < $num; ++$i) { require $file; } echo "Compile time: ", microtime(true) - $startTime, " seconds\n"; echo "Peak memory usage: ", memory_get_peak_usage(), " bytes\n"; This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters <?php error_reporting(E_ALL); $dir = __DIR__ . '/../PHP-Parser/lib'; spl_autoload_register(function($class) use($dir) { if (strpos($class, 'PhpParser') === 0) { require $dir . '/' . strtr($class, '\\', '/') . '.php'; } }); $it = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($dir . '/PhpParser'), RecursiveIteratorIterator::LEAVES_ONLY); $startTime = microtime(true); foreach ($it as $file) { if (!$file->isFile()) continue; require_once $file; } echo "Compile time: ", microtime(true) - $startTime, " seconds\n"; echo "Peak memory usage: ", memory_get_peak_usage(), " bytes\n";You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.3