[php-src] Issue #8118: Building php extensions take twice as long since PHP 8.1

From: Date: Sat, 19 Feb 2022 14:34:40 +0000
Subject: [php-src] Issue #8118: Building php extensions take twice as long since PHP 8.1
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-239891@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/8118 Comment Author: mvorisek I have written a script to analyse the raw CI files from Github Actions build: ``` <?php class File { public $p; public $content; public $lines; public function __construct(string $p) { $this->p = $p; $this->content = file_get_contents($this->p); $this->lines = $this->parseLines($this->content); } protected function parseLines(string $content): array { $lines = []; $tsPrev = null; $tsFracPrev = null; foreach (explode("\n", trim($content)) as $rawLine) { $rawLineParts = explode(' ', $rawLine, 2); $timeParts = explode('.', $rawLineParts[0], 2); $ts = \DateTime::createFromFormat('!Y-m-d\TH:i:s', $timeParts[0], new \DateTimeZone('UTC')); $tsFrac = rtrim($timeParts[1], 'Z'); $tsDiff = $tsPrev === null ? 0.0 : ($ts->getTimestamp() - $tsPrev->getTimestamp()) + ($tsFrac - $tsFracPrev) * 1e-7; $tsPrev = $ts; $tsFracPrev = $tsFrac; $lines[] = [$tsDiff, $rawLineParts[1]]; } return $lines; } public function findSlowLines(): array { $res = []; $prevLines = []; $addPrevToRes = function () use (&$res, &$prevLines) { $t = 0.0; $str = ''; foreach ($prevLines as $lineArr) { $t += $lineArr[0]; $str .= ($str === '' ? '' : ' ') . $lineArr[1]; } $prevLines = []; $res[] = [$t, $str]; }; foreach ($this->lines as $lineArr) { // split by major actions or slow operations if (preg_match('~^Step \d+/\d+ : |^###~', $lineArr[1])/* || $lineArr[0] > 0.5*/) { $addPrevToRes(); } $prevLines[] = $lineArr; } $addPrevToRes(); return $res; } public function slowLinesToFile(string $p): void { $slowLines = $this->findSlowLines(); $resLines = []; foreach ($slowLines as $slowLineArr) { $resLines[] = number_format($slowLineArr[0], 7) . "\t" . substr($slowLineArr[1], 0, 500); } file_put_contents($p, implode("\n", $resLines)); } } $f80 = new File(__DIR__ . '/80.txt'); $f81 = new File(__DIR__ . '/81.txt'); print_r($f80->findSlowLines()); $f80->slowLinesToFile(__DIR__ . '/80-parsed.txt'); $f81->slowLinesToFile(__DIR__ . '/81-parsed.txt'); ``` and discovered, the gd build is superslow: ![image](https://user-images.githubusercontent.com/2228672/154805222-76fc113c-c452-4248-b23b-24a96cd34384.png) PHP 8.0 build time: 12.5 s, PHP 8.1 476.2 s

« previous php.bugs (#239891) next »