[pLog-svn] __autoload very slow ...

Mark Wu markplace at gmail.com
Tue Oct 9 03:27:52 EDT 2007


Hi Oscar:

mmm ... I just test it.

Without pre-defined class loader map, the memory usage of
admin.php?op=newPost is 6947,032 bytes
With pre-defined class loader map, the memory usage of admin.php?op=newPost
is 7036,992 bytes

So, the big array is allocate about 89,960 bytes. It  increases 87-88KB
memory usage for each request.

The result is acceptable.

BTW, I use xdebug_peak_memory_usage(); to get the memory usge.

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: Tuesday, October 09, 2007 3:01 PM
> To: LifeType Developer List
> Subject: Re: [pLog-svn] __autoload very slow ...
> 
> Thanks, this is good work.
> 
> I also figured out the reason of the naming scheme of the 
> Zend classes a while ago, and while I think it's pretty 
> smart, I also think that the class names are pretty ugly :)
> 
> By the way, have you noticed if there is any impact with 
> regards to memory usage when loading the big array with all 
> the class names and paths?
> 
> Oscar
> 
> On 10/9/07, Mark Wu <markplace at gmail.com> wrote:
> > BTW, now I know why Zend's class naming is so ugly. Becasue it is 
> > easier to implement __autoload feature.
> >
> > They use Zend_ABC_DEF as the class name, it easy for them to ask the
> > __autoload() function to search ./Zend/ABC/DEF only, it can 
> save a lof 
> > of time.
> >
> > Mark
> >
> > > -----Original Message-----
> > > From: Mark Wu [mailto:markplace at gmail.com]
> > > Sent: Tuesday, October 09, 2007 11:41 AM
> > > To: 'LifeType Developer List'
> > > Subject: RE: [pLog-svn] __autoload very slow ...
> > >
> > > Hi All:
> > >
> > > After the change with rev. 5979 & 5980. I think the performance 
> > > issue is solved.
> > >
> > > I just test the original lt_include scripts, auto load 
> only scripts 
> > > and pre-defined class loader map scripts. The performace of  
> > > "pre-defined class loader map scripts" is as good as "original 
> > > lt_include scripts".
> > >
> > > Now, windows lifetype developer can enjoy the autoload 
> features, too.
> > >
> > > Regards, 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: Monday, October 08, 2007 8:12 PM
> > > > To: LifeType Developer List
> > > > Subject: Re: [pLog-svn] __autoload very slow ...
> > > >
> > > > I was wondering how long it will take people to test this...
> > > > Not long :)
> > > >
> > > > We can create a pre-defined array that contains the
> > > locations of all
> > > > files. Although there's quite many of those, finding a 
> single file 
> > > > should be pretty quick.
> > > >
> > > > But if it's a performance problem in windows, maybe there
> > > isn't much
> > > > we can do. All I can say is that I felt no performance 
> increase or 
> > > > decrease in my OS X laptop, and OS X is not exactly known
> > > for being a
> > > > speed demon.
> > > >
> > > > On 10/8/07, Mark Wu <markplace at gmail.com> wrote:
> > > > >
> > > > >
> > > > > Actually, I will suggest we revert to the old way +
> > > > autoload new features.
> > > > >
> > > > > So, if developer know lifetype very well, then he can include 
> > > > > the lifetype related files by him self in front of 
> each scripts.
> > > > >
> > > > > If he is a new developer, then he can enjoy the benifit
> > > > from the new
> > > > > autoload feature (With the pre-scan scripts array as I
> > > suggested) .
> > > > >
> > > > > Mark
> > > > >
> > > > >
> > > > >  ________________________________
> > > > >  From: Mark Wu [mailto:markplace at gmail.com]
> > > > > Sent: Monday, October 08, 2007 5:58 PM
> > > > >
> > > > > To: 'LifeType Developer List'
> > > > > Subject: RE: [pLog-svn] __autoload very slow ...
> > > > >
> > > > >
> > > > >
> > > > > I just check the code, there are several stuffs will impact
> > > > the performance:
> > > > >
> > > > > 1. The order of folders:
> > > > >     - If the file is locate in the last folder, then the
> > > > autload have
> > > > > to check all the folders
> > > > >
> > > > > 2. The number of folders:
> > > > >     -There are about 110 folders in the folder list array.
> > > > I think it
> > > > > is too much folders for autoload
> > > > >
> > > > > 3. The file I/O
> > > > >     - It seems the file I/O under windws is much worse then 
> > > > > Unix/Linux, that why Oscar feel no big difference 
> with autoload.
> > > > >
> > > > > For adapt the new autoload feature in lifetype with such
> > > > big quantity
> > > > > of folders, I think we should try to use the same skill
> > > we used in
> > > > > script checks.
> > > > >
> > > > > To generate a $include_script[$key] = $value; file 
> for autoload.
> > > > >
> > > > > Then we just use array_key_exist to check the $key exist or
> > > > not. Then
> > > > > include the file.
> > > > >
> > > > > It will save a lot of time.
> > > > >
> > > > > Mark
> > > > >
> > > > >
> > > > >  ________________________________
> > > > >  From: Mark Wu [mailto:markplace at gmail.com]
> > > > > Sent: Monday, October 08, 2007 5:36 PM
> > > > > To: 'LifeType Developer List'
> > > > > Subject: RE: [pLog-svn] __autoload very slow ...
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > I forgot to say this is the result of admin.php?op=newPost
> > > > >
> > > > > You can see there are over 7700 function call of 
> file_exists().
> > > > >
> > > > > If each file_exists call() takes 1 ms. It will takes 
> 15 seconds ..
> > > > >
> > > > > It is so amazing.
> > > > >
> > > > > Mark
> > > > >
> > > > >
> > > > >  ________________________________
> > > > >  From: Mark Wu [mailto:markplace at gmail.com]
> > > > > Sent: Monday, October 08, 2007 5:23 PM
> > > > > To: 'LifeType Developer List'
> > > > > Subject: RE: [pLog-svn] __autoload very slow ...
> > > > >
> > > > >
> > > > >
> > > > > Hi All:
> > > > >
> > > > > I just attached my profiling file and the result with
> > > > wincachegrined.
> > > > > You can see the bottle neck is in file_exists.
> > > > >
> > > > > It takks about 12 seconds.
> > > > >
> > > > > wow ...
> > > > >
> > > > > Mark
> > > > >
> > > > >
> > > > >
> > > > >  ________________________________
> > > > >  From: plog-svn-bounces at devel.lifetype.net
> > > > > [mailto:plog-svn-bounces at devel.lifetype.net] On 
> Behalf Of Mark 
> > > > > Wu
> > > > > Sent: Monday, October 08, 2007 4:16 PM
> > > > > To: 'LifeType Developer List'
> > > > > Subject: [pLog-svn] __autoload very slow ...
> > > > >
> > > > >
> > > > >
> > > > > Hi Oscar:
> > > > >
> > > > > I just test the new autoload under windows, the performace
> > > > is very bad under
> > > > > windows ( apache 2.2.4, PHP5 5.2.3 & Mysql 5.0)
> > > > >
> > > > > In original lt_include version, every request can finished
> > > > within less 1-2
> > > > > seconds.
> > > > >
> > > > > But, in new autoload version, every request takes almost
> > > > 25-35 seconds to
> > > > > show up the page ...
> > > > >
> > > > > I check the cpu loading, it always in 100%. It seems PHP
> > > > just try search the
> > > > > include files recursivelly
> > > > >
> > > > > It is really terrible ....
> > > > >
> > > > > Do I need to do any special setup in PHP.ini for autoload?
> > > > >
> > > > > Mark
> > > > >
> > > > >
> > > > > _______________________________________________
> > > > > 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
> >
> _______________________________________________
> 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