[pLog-svn] The use of constants

Ammar Ibrahim ammar.ibrahim at gmail.com
Thu Apr 26 06:04:43 EDT 2007


You're right Oscar. Anyhow, as of next week we'll start rewriting our system
on LT1.3 . We will benchmark and profile quite a lot as we go, and we'll
share our findings/fixes/features with you.

Thanks,
   Ammar


On 4/25/07, Oscar Renalias <oscar at renalias.net> wrote:
>
> Just as I thought, you can't remove constants just because they're
> "slow" without compromising code readability a *lot*. Would you rather
> see switch() or if() statements where a variable is checked against
> proper constant names or against "magic" numbers? I suppose end users
> and server admins don't really care that much but we as developers do
> care about these things.
>
> Now with all said, you can try to edit the file
> class/plugin/eventlist.properties.php and remove its contents. It
> contains a bunch of constants that identify each one of the events
> generated by the core, and they're not really needed if you're not
> using certain plugins. If any of you has the time to benchmark LT with
> and without these constants defined, please let us know about the
> results.
>
> Oscar
>
> On 4/23/07, Oscar Renalias <oscar at renalias.net> wrote:
> > How are you supposed to use global variables in method definition? As
> in:
> >
> > function myFunction( $param1 = MY_CONSTANT )
> >
> > Versus:
> >
> > function myFunction( $param1 = $can_I_use_a_global_variable_here )
> >
> > Does that even work?? Or please clarify what you mean by "global
> variables".
> >
> > Oscar
> >
> > On 4/23/07, Ammar Ibrahim <ammar.ibrahim at gmail.com> wrote:
> > >
> > >
> > > On 4/23/07, Reto Hugi <plog at hugi.to> wrote:
> > > > Ammar Ibrahim wrote:
> > > > > I don't like globals as well, they are a bad software engineering
> > > > > practice. But if they are faster, I don't care.
> > > >
> > > > well, we do. Else we wouldn't do OO programming. sometimes it's
> worth to
> > > > sacrifice speed over
> > >
> > > What if the sacrifice is major? we could at least use global variables
> > >
> > > > > Benchmark and let us know :) but use PHP5
> > > >
> > > > Things you should know and keep in mind during the performance
> tests:
> > > >
> > > > - most or at least a significiant amount of users have php4 not
> php5.
> > > > that's why we provide backward compliance. we won't implement
> > > > improvements that brake the compliance.
> > >
> > > of course.
> > >
> > > > - we are not really interested in improvements other versions than
> > > > lifetype 1.2 as this is the version we support.
> > >
> > > I'm migrating to 1.2
> > >
> > > > - inlude_once was replaced with lt_include in 1.2 to improve
> performance
> > > > (lt_include does not lead to file access operations on every call -
> > > > there might be more to it, but that's what I remember...)
> > > > _______________________________________________
> > > > 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
> > >
> >
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.lifetype.net
> http://limedaley.com/mailman/listinfo/plog-svn
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://limedaley.com/pipermail/plog-svn/attachments/20070426/f0efaad9/attachment.htm 


More information about the pLog-svn mailing list