Re: Feature Request: inline pseudo-instruction
| From: | Christoph M. Becker | Date: | Tue, 04 Oct 2016 16:40:42 +0000 |
| Subject: | Re: Feature Request: inline pseudo-instruction | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-96231@lists.php.net to get a copy of this message | ||
On 04.10.2016 at 13:33, Pascal KISSIAN wrote:
> I have an application where a small file is included at multiple places.
>
> So far so good.
>
> The problem is that this include consists in a small piece of code which is
> inside a multi-level loop.
>
> The include is done about an average of 100.000 times .
>
> When I manually replace the include with the code which is inside, the
> performance boost is about a 50-100 factor..
> (with opcache enabled, it is far worst without opcache).
>
> The problem is that if I make a change within the code, I do have to not
> forget to make changes a dozen of places...
>
> Could it be possible to add a directive such as :
>
> inline < filename >
>
> That includes the file inline within the compiled pseudo code (at compile
> time) ...
>
> (it does not have a big importance for me that the target pseudo-code sets
> the line number of all inlined instructions to the line number of the inline
> directive)
>
> Am I the only people needing this feature ?
If you really need this feature, I suggest that you're using a
preprocessor to prepare the files before they're compiled by PHP. A
rather simple PHP script using preg_replace() might already be sufficient.
--
Christoph M. Becker