[pLog-svn] This is not fair

Ahmad Saleh ahmadfds at gmail.com
Fri Nov 9 08:00:21 EST 2007


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.

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.

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.

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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://limedaley.com/pipermail/plog-svn/attachments/20071109/d5d1cb99/attachment.htm 


More information about the pLog-svn mailing list