[pLog-svn] A terrible truth about plugin

Mark Wu markplace at gmail.com
Sat Feb 2 11:38:33 EST 2008

Hi Oscar:
1. About the  array_merge(), I just check the result again.... I think it is
slow becasue the include(), not array_merge. In my test case, I need to load
extra 14 locale files... So, there is nothing we can do with it...  :(
Maybe ask user or develer merge thier plugin locale into the core and reduce
the file I/O access in thier production server.
2. Do you have any ideas about the menu structure? Maybe I can try to
implement it... 
3. About the admin page cache, any ideas?


From: plog-svn-bounces at devel.lifetype.net
[mailto:plog-svn-bounces at devel.lifetype.net] On Behalf Of Oscar Renalias
Sent: Saturday, February 02, 2008 5:32 PM
To: LifeType Developer List
Subject: Re: [pLog-svn] A terrible truth about plugin

I had already been considering to replace menu.xml with something else,
probably with a native array (so that we can store all the different
attributes that are stored in the menu file) and then while keeping the API
interface, replace the code inside. But I obviously have not had the time...

I would drop the XML and consider a multidimensional array.

About the locales, what's the performance penalty of using array_merge? Is
array_merge the slow part or is it something else?

On Feb 1, 2008, at 8:20 PM, Mark Wu wrote:

After several testing, I think I know why our plugin is so slow...
The problem is plugin menu & locales :(
In our plugin framework, we can add menu on the fly, it is good. But it use
XML_Tree(from pear), and it always lookup the specific node and add the
plugin menu as its child in each request. So, if we have 1 plugin, and 2
menu entries, it will search the menu tree twice. If we have 14 plugins and
each plugin has 2 menu entries, it will search 28 times ....
The second problem is our plugin locales. Iit use array_merge() to merge the
plugin locales into core locales.... 
For 1st problem, I have no idea how to solve it, maybe we can change it to
simplexml (native xml support) in php5 to see it increse any performance or
For 2nd problem, maybe we can use include() only, 
For production server, I think add all menu to menu.xml and all locales to
core locale file is very helpful......
Here is the test result when I open editArticleCategories page: (I test it
under  php5, apache 2.2 & mysql5 on a slow pentium M 1.8GHZ with 2G ram with
window xp)
1. LifeType core + 14 plugins (8 with xml menu entries setting) : 1000 ms
2. (1) and remove all locale files : 900ms
3. (1) and remove all plugins: 550ms
Just for your reference.
pLog-svn mailing list
pLog-svn at devel.lifetype.net

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://limedaley.com/pipermail/plog-svn/attachments/20080203/26ba58c6/attachment.htm 

More information about the pLog-svn mailing list