Re: Optional pre-compiler for PHP8?
| From: | Benjamin Morel | Date: | Mon, 28 Oct 2019 09:03:50 +0000 |
| Subject: | Re: Optional pre-compiler for PHP8? | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-107721@lists.php.net to get a copy of this message | ||
>
> This would break as soon as we have two versions of a class, and a
> runtime choice which of them to use.
> (see also Mark Randall's comment)
That's why I'm suggesting to only make these optimizations when preloading
<https://wiki.php.net/rfc/preload>is in use,
which means that you know
ahead of time the class definitions, and you cannot have 2 runtime
definitions of a given class.
No preloading = no optimizations.
Full preloading (whole codebase) = maximum optimizations.
Partial preloading = the compiler should still be able to optimize *some *of
the code involving only the preloaded classes.
We already have, since PHP 7.4, a mechanism to know static class
definitions on startup, so why not build further optimizations on top of it?
— Benjamin