HANDLE_NUMERIC()

php.internals

Sterling Hughes

23 years ago
Hi, I've attached a small patch which removes HANDLE_NUMERIC() from zend_hash.c, and moves it instead to the necessary places in zend_execute.c, in the form of a zend_is_numeric_key() function defined in zend_operators.c Anyhow, I'm getting a really nice performance increase. Although it depends on the usage, it certainly makes pretty much everything zippier (and dare I say sexier. :) -Sterling
-- "First they ignore you, then they laugh at you, then they fight you, then you win." - Gandhi

Andi Gutmans

23 years ago
At 12:52 PM 5/22/2003 -0400, Sterling Hughes wrote:
>Hi, > >I've attached a small patch which removes HANDLE_NUMERIC() from >zend_hash.c, and moves it instead to the necessary places in >zend_execute.c, in the form of a zend_is_numeric_key() function defined >in zend_operators.c > >Anyhow, I'm getting a really nice performance increase. Although it >depends on the usage, it certainly makes pretty much everything zippier >(and dare I say sexier. :)
I'm not sure you can be certain that other places in PHP don't use the feature of HANDLE_NUMERIC. Seems to be quite a dangerous patch to me even if you solved it for the symbol table. Andi

George Schlossnagle

23 years ago
On Thursday, May 22, 2003, at 02:58 PM, Andi Gutmans wrote:
> At 12:52 PM 5/22/2003 -0400, Sterling Hughes wrote: >> Hi, >> >> I've attached a small patch which removes HANDLE_NUMERIC() from >> zend_hash.c, and moves it instead to the necessary places in >> zend_execute.c, in the form of a zend_is_numeric_key() function >> defined >> in zend_operators.c >> >> Anyhow, I'm getting a really nice performance increase. Although it >> depends on the usage, it certainly makes pretty much everything >> zippier >> (and dare I say sexier. :) > > I'm not sure you can be certain that other places in PHP don't use the > feature of HANDLE_NUMERIC. > Seems to be quite a dangerous patch to me even if you solved it for > the symbol table.
Yeah... seems safer using your leaner symbol tables where appropriate rather than carving up the current implementation. George

Sterling Hughes

23 years ago
On Thu, 2003-05-22 at 15:02, George Schlossnagle wrote:
> On Thursday, May 22, 2003, at 02:58 PM, Andi Gutmans wrote: > > > At 12:52 PM 5/22/2003 -0400, Sterling Hughes wrote: > >> Hi, > >> > >> I've attached a small patch which removes HANDLE_NUMERIC() from > >> zend_hash.c, and moves it instead to the necessary places in > >> zend_execute.c, in the form of a zend_is_numeric_key() function > >> defined > >> in zend_operators.c > >> > >> Anyhow, I'm getting a really nice performance increase. Although it > >> depends on the usage, it certainly makes pretty much everything > >> zippier > >> (and dare I say sexier. :) > > > > I'm not sure you can be certain that other places in PHP don't use the > > feature of HANDLE_NUMERIC. > > Seems to be quite a dangerous patch to me even if you solved it for > > the symbol table. > > Yeah... seems safer using your leaner symbol tables where appropriate > rather than carving up the current implementation. >
What areas rely on it though? Think about how esoteric this usage is. AFAICT (and Zeev) HANDLE_NUMERIC() is only used when you assign to an array: $ar["20"] = 10; Where else to imagine that this feature would be used? The only place that really concerns me is engine level, but I can't find the problem there. As far as extension space, I've written enough extensions and maintained enough "extension-ish" code, and I haven't run across this once. Leaner hashtables may also be an option, but I can't see a reason that HANDLE_NUMERIC() belongs in the hash table implementation. -Sterling
-- Good judgement comes from experience, and experience comes from bad judgement. - Fred Brooks

Andrei Zmievski

23 years ago
On Thu, 22 May 2003, Sterling Hughes wrote:
> What areas rely on it though? Think about how esoteric this usage is. > AFAICT (and Zeev) HANDLE_NUMERIC() is only used when you assign to an > array: > > $ar["20"] = 10; > > Where else to imagine that this feature would be used? The only place > that really concerns me is engine level, but I can't find the problem > there. As far as extension space, I've written enough extensions and > maintained enough "extension-ish" code, and I haven't run across this > once. > > Leaner hashtables may also be an option, but I can't see a reason that > HANDLE_NUMERIC() belongs in the hash table implementation.
Sterling, I think you should go to college to reduce your amount of free time. That, or become a merchant sailor. :) -Andrei "When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute, and it's longer than any hour. That's relativity." -- Einstein, on relativity

David Sklar

23 years ago
On Thursday, May 22, 2003 3:09 PM mailto:andrei@gravitonic.com wrote:
> Sterling, > > I think you should go to college to reduce your amount of free time. > That, or become a merchant sailor. :) > > -Andrei
The guy sitting behind me on the plane ride home from Amsterdam was in the merchant marines, on his way home from Saudi Arabia. He told me some stories that made it seem like Sterling would fit right in. :) David

Andrei Zmievski

23 years ago
On Thu, 22 May 2003, David Sklar wrote:
> The guy sitting behind me on the plane ride home from Amsterdam was in the > merchant marines, on his way home from Saudi Arabia. He told me some stories > that made it seem like Sterling would fit right in. :)
See there is a place for a mind^H^H^H^Hego too large for its age. :) -Andrei * 2 + 2 = 5 for extremely large values of 2. *

Andi Gutmans

23 years ago
Sterling, I discussed your patch with Zeev. He convinced me that the chance of other PHP extensions taking advantage of HANDLE_NUMERIC is slim and that if this exists, we'll find it by the time we release PHP 5. So I think you should commit it. Andi At 09:58 PM 5/22/2003 +0300, Andi Gutmans wrote: