Re: [PATCH] No runtime fetching of built-in global constants
| From: | Matt Wilmas | Date: | Wed, 23 Jul 2008 14:10:37 +0000 |
| Subject: | Re: [PATCH] No runtime fetching of built-in global constants | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-39227@lists.php.net to get a copy of this message | ||
Hi all,
Never heard anything about this optimization after sending it 3 months ago
(should've sent a follow-up sooner)...
Is this something that can be done? Dmitry? Details in original message.
Patch is unchanged, I just updated them for the current file versions.
http://realplain.com/php/const_ct_optimization.diff
http://realplain.com/php/const_ct_optimization_5_3.diff
Thanks,
Matt
----- Original Message -----
From: "Matt Wilmas"
Sent: Friday, April 18, 2008
> Hi all,
>
> I changed things so that the many "built-in" constants (CONST_PERSISTENT
> ones) will be replaced at compile-time, saving the FETCH_CONSTANT opcode,
if
> these changes are usable. This was added for TRUE/FALSE/NULL 2 years ago,
> but seems like it can be done for "lots" of others too.
>
> Since the change 2 years ago, other constants have been getting looked up
> also, but just discarded. And if a constant wasn't found, its name was
> lowercased and looked up again (for case-insensitive TRUE/FALSE/NULL).
> Lowercasing has been removed, since case-insensitive constants can't be
done
> (guess an exception was made for TRUE/FALSE/NULL :-)), and TRUE/FALSE/NULL
> get flagged in the scanner (not reserved words, which Marcus did briefly a
> few years ago), skipping a hash lookup. BTW, to get this compile-time
> optimization in a namespace, it needs to be prefixed (::CONSTANT).
>
> I also removed an unnecessary memcmp() in zend_get_constant() -- old code
> that was needed a long time ago, it appears.
>
> http://realplain.com/php/const_ct_optimization.diff
> http://realplain.com/php/const_ct_optimization_5_3.diff
>
> Thoughts?
>
>
> Thanks,
> Matt