On Sun, Mar 7, 2021 at 10:21 AM Levi Morrison <morrison.l...@gmail.com> wrote:
>
> Hello!
>
> Most of PHP's symbols are case insensitive. This means extensions that
> need to do things with function and method names end up lowercasing
> and hashing the lowercased names, often having to do more memory
> allocations too. Since case insensitive symbols is language dictated
> behavior, it makes sense to expose the correctly cased symbols to
> extensions. In PHP 8.0 (and possibly older, I did not check), the
> engine is already interning the lowercased name of user defined
> functions; it's just not made available to extensions.
>
> In my ideal world, we'd actually switch all symbols to be case
> sensitive. However, that won't be happening for PHP 8 due to BC.
>
> So, instead, I propose adding an `.lcname` member (or some other name
> indicating it's been normalized to the preferred PHP case) to at least
> zend_op_array and zend_class_entry, but preferably for internal
> functions too. Note that many internal functions will already be
> lowercase, so the data can be shared.
>
> I could make this change in the main engine, but I strongly suspect it
> will not play correctly with opcache.
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: https://www.php.net/unsub.php
>

I just realized I didn't ask any specific questions. Oops:

 1. Can anyone think of issues except increased memory due to
increasing the size of the struct? Since the strings were previously
interned, I don't think the strings themselves will have much effect
on memory usage (but we can measure this).
 2. Anyone else who thinks this would be useful?

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

Reply via email to