From b964e2f4114ca63aab019c7fdea6361f8ab7a1ae Mon Sep 17 00:00:00 2001 From: Adrian Jones Date: Tue, 18 Aug 2026 07:10:14 -0700 Subject: [PATCH] Bar: info panel gets OPcache status without the scripts table opcache_get_status() defaults to $include_scripts=true, which builds an entry for every script in the opcode cache - a cache-wide list, so every vhost sharing the PHP pool inflates it. The result was used only for a membership test against get_included_files(). opcache_is_script_cached() answers that question per file with one hash lookup, so $include_scripts can be false. Measured with 1365 cached scripts on PHP 8.5: 156.92ms -> 0.06ms, with the row reporting the same "100 % cached". jit, memory_usage, interned_strings_usage and opcache_statistics are all still returned, so nothing else changes. --- src/Tracy/Bar/panels/info.panel.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Tracy/Bar/panels/info.panel.php b/src/Tracy/Bar/panels/info.panel.php index 325a9cad1..4878af78e 100644 --- a/src/Tracy/Bar/panels/info.panel.php +++ b/src/Tracy/Bar/panels/info.panel.php @@ -25,8 +25,10 @@ return $ip; }; -$opcache = function_exists('opcache_get_status') ? @opcache_get_status() : null; // @ can be restricted -$cachedFiles = isset($opcache['scripts']) ? array_intersect(array_keys($opcache['scripts']), get_included_files()) : []; +$opcache = function_exists('opcache_get_status') ? @opcache_get_status(false) : null; // @ can be restricted +$cachedFiles = $opcache && function_exists('opcache_is_script_cached') + ? array_filter(get_included_files(), fn(string $file): bool => @opcache_is_script_cached($file)) + : []; $jit = $opcache['jit'] ?? null; $info = [