Bug #79353 [Com]: bad optimizing "Null Coalescing Assignment"

From: Date: Tue, 10 Mar 2020 10:29:40 +0000
Subject: Bug #79353 [Com]: bad optimizing "Null Coalescing Assignment"
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-225996@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79353&edit=1 ID: 79353 Comment by: bugreports at gmail dot com Reported by: bugreports at gmail dot com Summary: bad optimizing "Null Coalescing Assignment" Status: Assigned Type: Bug Package: opcache PHP Version: 7.4Git-2020-03-08 (Git) Assigned To: nikic Block user comment: N Private report: N New Comment: as i understand that it will be part of PHP8 and not optimized for 7.4? Previous Comments: ------------------------------------------------------------------------ [2020-03-09 15:21:19] nikic@php.net https://github.com/php/php-src/commit/d9c45d86f9cd3d20f66ebf38384a9f53113415e5 Pi node placement turned out to be more complicated than anticipated, because it did not pass our existing profitability heuristic. ------------------------------------------------------------------------ [2020-03-09 14:34:50] nikic@php.net I think we mainly need to add pi node placement for coalesce. ------------------------------------------------------------------------ [2020-03-08 02:46:53] bugreports at gmail dot com Description: ------------ with opcache other than "Null coalescing operator" the "Null Coalescing Assignment" is not completly optimized out function a() { $test = $test ?? TRUE; return $test; } function b() { $test ??= TRUE; return $test; } runtime difference with 50000000 calls: a(): 3.1884 b(): 3.3666 function name: a number of ops: 2 ---------------------------------------------------------------------------------- 5 0* COALESCE ~1 !0 6 1* RETURN <true> function name: b number of ops: 3 ---------------------------------------------------------------------------------- 11 0* COALESCE ~1 !0 1* ASSIGN $2 !0, <true> 12 2* RETURN !0 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=79353&edit=1

« previous php.bugs (#225996) next »