[pLog-svn] The use of constants

Jon Daley plogworld at jon.limedaley.com
Mon Apr 23 08:12:36 EDT 2007


 	It was discussed a long time ago on this list.  Someone forwarded 
a power point doc describing performance benefits of making your own.  I 
haven't gotten around to seeing if we should be using "include" inside of 
our lt_include instead of "include_once".  Intuitively, it should be 
faster with "include".
 	Oscar did tests with our lt_include, and it was faster than 
include_once.  I think it had something to do with relative pathnames, and 
a lot of string parsing that lt_include does, and so if you know you 
always have absolute path names, you can make the code simpler.

On Mon, 23 Apr 2007, Ahmad Saleh wrote:

> why are you use this "lt_include", I think include_once make what this
> function
> make
>
> Regards,
> Ahmad
>
> On 4/23/07, Ammar Ibrahim <ammar.ibrahim at gmail.com> wrote:
>> 
>> I had figures, I can regenerate them. I'm not using 1.2.x this is why I
>> don' have lt_include. define() was around 60% of page execution when a page
>> was cached. and you have only 300 define() calls. If you were to generate 
>> an
>> index page with lots of data and statistics from different parts, they can
>> grow to thousands.
>> 
>> Which version of PHP are you using? and are you using APC ?
>> 
>> 
>> btw, for profiling I heard that APD is better, the author of xdebug is my
>> friend and he mentioned that APD might have a slight advantage over xdebug
>> in profiling currently.
>> 
>> 
>> - Ammar
>> 
>> On 4/23/07, Tsz Ming WONG <tszming at gmail.com> wrote:
>> >
>> > I have just run a simple xdebug profiling on the LT blog index (1.2.1)
>> >
>> > Function, Total Self, Total Cum, Calls
>> >
>> > php::define, 1.9ms, 1.9ms, 300
>> > lt_include, 270ms, 805ms, 134
>> >
>> >
>> > in fact, not that slow as you mentioned...do you have any figures?
>> >
>> >
>> > best regards,
>> > tszming
>> >
>> > On 4/23/07, Ammar Ibrahim <ammar.ibrahim at gmail.com> wrote:
>> > >
>> > >
>> > > On 4/23/07, Tsz Ming WONG < tszming at gmail.com> wrote:
>> > > > 1. if you don't use constant, what will you use? hard code them into
>> > the
>> > > codes?
>> > >
>> > > Global  variables, or in PHP5 static class variables.
>> > >
>> > > > 2. the real slow down is include_once() AFAIK
>> > >
>> > > true, this is a slow down as well. In my profiling tests. include_once
>> > took
>> > > so much time, but less than define()
>> > _______________________________________________
>> > pLog-svn mailing list
>> > pLog-svn at devel.lifetype.net
>> > http://limedaley.com/mailman/listinfo/plog-svn
>> >
>> 
>> 
>> _______________________________________________
>> pLog-svn mailing list
>> pLog-svn at devel.lifetype.net
>> http://limedaley.com/mailman/listinfo/plog-svn
>> 
>

-- 
Jon Daley
http://jon.limedaley.com/

Reality is what refuses to go away when I stop believing in it.
-- Philip K. Dick


More information about the pLog-svn mailing list