[php-src] PR #22829: [PFA 4/n] Optimize constant pre-bound arguments

From: Date: Mon, 20 Jul 2026 13:29:08 +0000
Subject: [php-src] PR #22829: [PFA 4/n] Optimize constant pre-bound arguments
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-37189@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/22829 Author: arnaud-lb The branch includes GH-22785, but only the commit "[PFA 4/n] Optimize constant pre-bound arguments" is relevant for this PR. --- PFA pre-bound arguments are bound to the generated closure's lexical vars: ``` function f($a, $b) {} $f = f(1, ?); // Generates: $tmp = 1; $f = function ($b) use ($tmp) { return f($tmp, $b); }; ``` Detect which pre-bound arguments are constant and burn them into the generated closure instead: ``` function f($a, $b) {} $f = f(1, ?); // Generates: $f = function ($b) { return f(1, $b); }; ``` This reduces the overhead during both instantiation and invocation of PFAs.

« previous php.git-pulls (#37189) next »