Re: [PHP-DEV] Tie'ing variables

[email protected] (Sterling Hughes)
Newsgroups php.dev
Message-ID <1046632215.21516.1463.camel@hasele>
On Sun, 2003-03-02 at 14:22, Shane Caraveo wrote:
> So I'm not clear on how I am should expect this to work.  A simple script:
> 
> error_reporting(2047);
> print_r($_ENV);
> 
> is now completely broken unless you turn on register_long_arrays.  If 
> that is expected behaviour, register_long_arrays must be on by default.
> 

Of course its not the expected behavior.  The functionality isn't fully
integrated/mature yet. :)

-Sterling

> Shane
> 
> 
> Zeev Suraski wrote:
> > I wanted to do this for some time, but until recently, it wasn't very 
> > feasible, because the order of registration could be designated by the 
> > user (gpc_order, variables_order, etc.).  Now that register_globals is 
> > off by default, and that we have the auto-globals, it's much more feasible.
> > 
> > I implemented this optimization in CVS, so far only for $_ENV and 
> > $_SERVER.  This alone pushed nearly-empty-page req/sec pages from about 
> > 285 to about 400 on my Windows box.  I'll look into fixing the other 
> > ones later.
> > 
> > Pre-requisites for this optimization to kick in:
> > 1.  register_globals being off
> > 2.  register_long_arrays (HTTP_*_VARS) being off
> > 
> > If you want to benchmark w/ vs. w/o, you can disable the optimization by 
> > initializing cb to 0 in php_startup_auto_globals() and 
> > jit_initialization to 0 in php_hash_environment(), both in 
> > main/php_variables.c.
> > 
> > Zeev
> > 
> > At 18:26 01/03/2003, Sterling Hughes wrote:
> > 
> >> Hi,
> >>
> >> Analyzing PHP's routines a bit, it seems that the slowest part of a
> >> "generic" request is populating the special arrays, $_ENV, $_GET, etc.
> >>
> >> I was wondering if it might be possible to "tie" these arrays to a
> >> function (if you don't understand that, look at Perl for a definition).
> >> One could populate them as an overloaded object, and then array accesses
> >> would work - I guess.  But I would prefer a cleaner mechanism.
> >>
> >> This would prevent a costly overhead for elements that don't really need
> >> to be there, and yield only a slight performance cost when accessing
> >> overloaded elements in these arrays.
> >>
> >> -Sterling
> >>
> >> -- 
> >> "The computer programmer is a creator of universes for which he
> >>  alone is responsible. Universes of virtually unlimited complexity
> >>  can be created in the form of computer programs."
> >>     - Joseph Weizenbaum
> >>
> >>
> >> -- 
> >> PHP Development Mailing List <http://www.php.net/>
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> > 
> > 
> > 
-- 
"Nothing is particularly hard if you divide it into small jobs." 
    - Henry Ford
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.