Doug MacEachern wrote:

> On Sun, 7 Oct 2001, Stas Bekman wrote:
> 
> 
>>I was trying to decide what's the best storage to use in the 
>>Apache-Registry modules, and whether to store frequently used $r info or 
>>  request for them every time I need them. So I've decided to benchmark 
>>(See my other post about Apache::Benchmark :).
>>
> 
> sounds good.  what about using references so the strings are not copied,
> like:
> 
> $a->[URI] = \$r->uri;
> 
> i guess the deref would add some overhead and probably not worth the lil
> bit of memory savings.


Yes, it's slower (name below: ref). I guess if the string was much 
bigger it could be a win:


            array  0 wallclock secs ( 0.90 usr +  0.00 sys =  0.90 CPU) 
@ 1111111.11/s (n=1000000)
      array_bless  0 wallclock secs ( 0.94 usr +  0.01 sys =  0.95 CPU) 
@ 1052631.58/s (n=1000000)
     array_method  6 wallclock secs ( 5.79 usr +  0.01 sys =  5.80 CPU) 
@ 172413.79/s (n=1000000)
    native_method  1 wallclock secs ( 2.49 usr +  0.01 sys =  2.50 CPU) 
@ 400000.00/s (n=1000000)
              ref  0 wallclock secs ( 1.11 usr +  0.02 sys =  1.13 CPU) 
@ 884955.75/s (n=1000000)
           scalar  1 wallclock secs ( 0.56 usr +  0.00 sys =  0.56 CPU) 
@ 1785714.29/s (n=1000000)


-- 


_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to