[pLog-svn] The use of constants

Oscar Renalias oscar at renalias.net
Wed Apr 25 15:58:00 EDT 2007


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
> >
>


More information about the pLog-svn mailing list