[pLog-svn] This is not fair

Oscar Renalias oscar at renalias.net
Fri Nov 9 09:51:52 EST 2007


On Nov 9, 2007 3:00 PM, Ahmad Saleh <ahmadfds at gmail.com> wrote:
> Hi guys,
>
> LifeType really is a great service, however, it's very slow, I like Lifetype
> and really I wish the best for it and for you guys.

We do what we can, but have you considered scaling your hardware up?
It sometimes helps. PHP, Apache and MySQL are quite good at scaling
upwards (more powerful servers) and horizontally (more servers)

> If you don't mind, I have some suggestions:
> 1) about __autoload: I think it's a great idea, and it will increase
> lifetype performance if you use it in a correct way, something like this:
>
> <?php
> $importList = array();
>
> //This will not load class directly from classes path, just load it when you
> need it
> function import($classPath) {
>     global $importList;
>     $classFullPath = APP_PATH.str_replace('.', '/', $classPath);
>     $className = basename($classFullPath);
>     $importList[$className] = $classFullPath.'.php';
>     if(!file_exists($importList[$className])) {
>         throw new Exception('File Doesn\'t Exists
> ['.$importList[$className].']');
>     }
> }
>
> //Catch unloaded classes
> function __autoload($className) {
>     global $importList;
>
>     if(isset($importList[$className])) {
>         include $importList[$className];
>     } else {
>          throw new Exception("Invalid Class Name [$className]");
>     }
>     return $className;
> }
> ?>
>
> and about load a classes just use it like this
> import('class.action.admin.AdminAddPostAction ');
>
> and keep your class file name exactly like ClassName.

I don't see how this can help, please elaborate.

The goal for implementing class autoloading was to remove all those
annoying lt_include() statements at the top of each one of our class
files. If we replace this:

lt_include( PLOG_CLASS_PATH."class/action/whatever.class.php" );

with your suggestion:

import( "class.action.Whatever" );

What did we gain here? If we're doing it to increase clarity and
reduce code cruft, we gained nothing as we still one import()
statement per class. If we're doing it for performance purposes, we
might as well revert to lt_include() as it won't get any faster than
that.

> 2) using the cache: smarty cache is great, but I think it's used in a wrong
> way,
> in each request, you already load [local files]  and plugins and ... , which
> will not be used if the template is cached.

There's some plugins that need to run regardless of the cached status
of the templates, such as those that register a filter in the
pipeline.

But there's already been some discussion about this topic recently and
there's still time to tackle this issue in the next major release. Do
you happen to have a proposal on how to implement this?

> 3) loading operations[controllers maps]: you can store this array elements
> in temp file and run a binary search on this array to get incoming operation
> action.
>
> Regards,
>     Ahmad
>
>
>
> On Nov 9, 2007 1:47 PM, Mark Wu <markplace at gmail.com> wrote:
> > Actually, I saw that post several days ago .....
> >
> > I was frustrated when you try to use __autoload :( , it is really makes
> the
> > LifeType so so slow in windows platform ...because it increse thousands
> > file_exist() execution time.
> >
> > I think we should mix the PHP4 skill in PHP5 implementation at this
> moment,
> > or it will cause our system to get very bad performance.
> >
> > Actually, I really like __get, __set and __call in PHP5, we can use it to
> > redeuce the complexity of our dbobjects....
> >
> > For example,  we can add a new property like $description without add new
> > getter and setter method. And we still can use getDescription() method to
> > get property $description  ... that's magic function for ...
> >
> > But, you know, it slow ....
> >
> > Mark
> >
> >
> >
> >
> > > -----Original Message-----
> > > From: plog-svn-bounces at devel.lifetype.net
> > > [mailto:plog-svn-bounces at devel.lifetype.net] On Behalf Of
> > > Oscar Renalias
> > > Sent: Friday, November 09, 2007 7:35 PM
> > > To: LifeType Developer List
> > > Subject: [pLog-svn] This is not fair
> > >
> > > It doesn't help if PHP implements lots of nice OOP features
> > > (that I was planning to use one day, such as Array iterators, "magic"
> > > accessors via __get and __set, and so on) if by using them we
> > > incur in some pretty annoyingly high performance overheads... See for
> > > yourselves:
> > >
> > > http://www.garfieldtech.com/blog/magic-benchmarks
> > >
> > > I just wanted to vent my frustrations about this topic with you... :)
> > >
> > > Oscar
> > > _______________________________________________
> > > 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
>


More information about the pLog-svn mailing list