Hey Dmitry

Out of curiousity: how does this compare to preloading? From what I understand 
preloading also links classes, which was one of the most important differences 
between preloading files and simply storing them in opcache. Does this change 
mean that preloading becomes much less relevant since class linking can now 
also happen at runtime?

Kind regards
Brent

> On 5 Feb 2021, at 15:03, Dmitry Stogov <dmitrysto...@gmail.com> wrote:
> 
> Hi,
> 
> I'm glad to present the result of my recent work - Inheritance Cache.
> 
> https://github.com/php/php-src/pull/6627
> 
> 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.
> 
> I'm going to merge this patch into master on next week.
> Please review and give your comments.
> 
> Thanks. Dmitry.

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to