From 4b79dba93202ed5640dff317046ce2fdd42e1d82 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Tue, 9 Feb 2021 22:53:57 +0300 Subject: Added Inheritance Cache. This is a new transparent technology that eliminates overhead of PHP class inheritance. PHP classes are compiled and cached (by opcahce) separately, however their "linking" was done at run-time - on each request. The process of "linking" may involve a number of compatibility checks and borrowing methods/properties/constants form parent and traits. This takes significant time, but the result is the same on each request. Inheritance Cache performs "linking" for unique set of all the depending classes (parent, interfaces, traits, property types, method types involved into compatibility checks) once and stores result in opcache shared memory. As a part of the this patch, I removed limitations for immutable classes (unresolved constants, typed properties and covariant type checks). So now all classes stored in opcache are "immutable". They may be lazily loaded into process memory, if necessary, but this usually occurs just once (on first linking). The patch shows 8% improvement on Symphony "Hello World" app. --- ext/opcache/tests/bug78014.phpt | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'ext/opcache/tests/bug78014.phpt') diff --git a/ext/opcache/tests/bug78014.phpt b/ext/opcache/tests/bug78014.phpt index 3b4d332828..63fc1b6db1 100644 --- a/ext/opcache/tests/bug78014.phpt +++ b/ext/opcache/tests/bug78014.phpt @@ -12,18 +12,8 @@ if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows ?> --FILE-- foo()); ?> ---EXPECTF-- -Warning: Can't preload unlinked class C: Parent with unresolved initializers B in %s on line %d - -Warning: Can't preload class B with unresolved initializer for constant X in %s on line %d - -Fatal error: Uncaught Error: Class "C" not found in %sbug78014.php:5 -Stack trace: -#0 {main} - thrown in %sbug78014.php on line 5 +--EXPECT-- +int(42) -- cgit v1.2.1