<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><blockquote type="cite"><div style="WORD-WRAP: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space"><div dir="ltr" align="left"><span class="849463416-02022008"><font face="新細明體" color="#0000ff" size="2">1. About the&nbsp; 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...&nbsp; :(</font></span></div></div></blockquote><div><br class="webkit-block-placeholder"></div><div>I can't think of a single case where a user might need 14 plugins at the same time... I'm not sure how much we should optimize for those cases.</div><div><br class="webkit-block-placeholder"></div><div>And in the case of big sites, perhaps we should write some instructions about how to merge plugin locales into the main one? We should obviously mention that this will make it more difficult to upgrade the plugin, but that it also has a performance advantage.</div><br><blockquote type="cite"><div style="WORD-WRAP: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space"> <div dir="ltr" align="left"><span class="849463416-02022008"><font face="新細明體" color="#0000ff" size="2"></font></span>&nbsp;</div> <div dir="ltr" align="left"><span class="849463416-02022008"><font face="新細明體" color="#0000ff" size="2">Maybe ask user or develer merge thier plugin locale into the core and reduce the file I/O access in thier production server.</font></span></div> <div dir="ltr" align="left"><span class="849463416-02022008"><font face="新細明體" color="#0000ff" size="2"></font></span>&nbsp;</div> <div dir="ltr" align="left"><span class="849463416-02022008"><font face="新細明體" color="#0000ff" size="2">2. Do you have any ideas about the menu structure? Maybe I can try to implement it...</font></span></div></div></blockquote><div><br class="webkit-block-placeholder"></div><div>One good way to do it is by doing a print_r of the entire XML_Tree object once it's loaded the menu. Amongst many other things, you should get an array representing the XML file, including all possible attributes.</div><div><br class="webkit-block-placeholder"></div><div>What I have in mind is something like this:</div><div><br class="webkit-block-placeholder"></div><div>$admin["menu"] = Array(</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>"url" =&gt; "?op=...",<br class="webkit-block-placeholder"></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>"localeId" =&gt; "...",<br class="webkit-block-placeholder"></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>"andPerms" =&gt; "...",<br class="webkit-block-placeholder"></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>"orPerms" =&gt; "..",<br class="webkit-block-placeholder"></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>"childs" =&gt; Array(<br class="webkit-block-placeholder"></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>"Manage" =&gt; Array(<br class="webkit-block-placeholder"></div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>"url" =&gt; "...",<br class="webkit-block-placeholder"></div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>"andPerms" =&gt; "...",<br class="webkit-block-placeholder"></div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>...<br class="webkit-block-placeholder"></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>),<br class="webkit-block-placeholder"></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>...<br class="webkit-block-placeholder"></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>)<br class="webkit-block-placeholder"></div><div>);</div><div><br class="webkit-block-placeholder"></div><div>I hope you get the idea :)</div><div><br class="webkit-block-placeholder"></div>Of course it's going to be a cumbersome task to conver the current menu.xml into this but hopefully we can automate it somehow.</div><div><br class="webkit-block-placeholder"></div><div>Then at the API level and in order to minimize impact to the plugins, we should aim to keep the current interfaces while hopefully speeding up the process. So basically adding &nbsp;a new menu under "/menu/Manage" would just mean something like isset($admin["menu"]["Manage"]) and then adding a new Array with all those "url", "localeId", "andPerms", etc.</div><div><br class="webkit-block-placeholder"></div><div>How would this sound?</div><div><br><blockquote type="cite"><div style="WORD-WRAP: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space"><div dir="ltr" align="left"><span class="849463416-02022008"><font face="新細明體" color="#0000ff" size="2"> </font></span></div> <div dir="ltr" align="left"><span class="849463416-02022008"><font face="新細明體" color="#0000ff" size="2"></font></span>&nbsp;</div> <div dir="ltr" align="left"><span class="849463416-02022008"><font face="新細明體" color="#0000ff" size="2">3. About the admin page cache, any ideas?</font></span></div></div></blockquote><div><br class="webkit-block-placeholder"></div><div>No. But I do know that it's going to be quite painful to add call to resetBlogCache() to all admin classes... It took us a few versions to get it right just for the public side, I can't even think how long it's going to take to get it right for the admin side.</div><br><blockquote type="cite"><div style="WORD-WRAP: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space"> <div dir="ltr" align="left"><span class="849463416-02022008"><font face="新細明體" color="#0000ff" size="2"></font></span>&nbsp;</div> <div dir="ltr" align="left"><span class="849463416-02022008"><font face="新細明體" color="#0000ff" size="2">Mark</font></span></div><br> <blockquote dir="ltr" style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">  <div class="OutlookMessageHeader" lang="zh-tw" dir="ltr" align="left">  <hr tabindex="-1">  <font face="Tahoma" size="2"><b>From:</b> plog-svn-bounces@devel.lifetype.net   [<a href="mailto:plog-svn-bounces@devel.lifetype.net">mailto:plog-svn-bounces@devel.lifetype.net</a>] <b>On Behalf Of </b>Oscar   Renalias<br><b>Sent:</b> Saturday, February 02, 2008 5:32 PM<br><b>To:</b>   LifeType Developer List<br><b>Subject:</b> Re: [pLog-svn] A terrible truth   about plugin<br></font><br></div>  <div></div>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...  <div><br class="webkit-block-placeholder"></div>  <div>I would drop the XML and consider a multidimensional array.</div>  <div><br class="webkit-block-placeholder"></div>  <div>About the locales, what's the performance penalty of using array_merge?   Is array_merge the slow part or is it something else?<br>  <div><br>  <div>  <div>On Feb 1, 2008, at 8:20 PM, Mark Wu wrote:</div><br class="Apple-interchange-newline">  <blockquote type="cite">    <div>    <div><font face="f0g40fi+" size="2"><span class="364065717-01022008">After several testing, I think I know why our     plugin is so slow...</span></font></div>    <div><font face="f0g40fi+" size="2"><span class="364065717-01022008"></span></font>&nbsp;</div>    <div><font face="f0g40fi+" size="2"><span class="364065717-01022008">The problem is plugin menu &amp; locales     :(</span></font></div>    <div><font face="f0g40fi+" size="2"><span class="364065717-01022008"></span></font>&nbsp;</div>    <div><font face="f0g40fi+" size="2"><span class="364065717-01022008">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&nbsp;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 ....</span></font></div>    <div><font face="f0g40fi+" size="2"><span class="364065717-01022008"></span></font>&nbsp;</div>    <div><font face="f0g40fi+" size="2"><span class="364065717-01022008">The second problem is our plugin locales. Iit use     array_merge() to merge the plugin locales into core locales....     </span></font></div>    <div><font face="f0g40fi+" size="2"><span class="364065717-01022008"></span></font>&nbsp;</div>    <div><font face="f0g40fi+" size="2"><span class="364065717-01022008">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 not.</span></font></div>    <div><font face="f0g40fi+" size="2"><span class="364065717-01022008"></span></font>&nbsp;</div>    <div><font face="f0g40fi+" size="2"><span class="364065717-01022008">For 2nd problem, maybe we can use include() only,     </span></font></div>    <div><font face="f0g40fi+" size="2"><span class="364065717-01022008"></span></font>&nbsp;</div>    <div><font face="f0g40fi+" size="2"><span class="364065717-01022008">For production server, I think add all menu to     menu.xml and all locales to core locale file is very     helpful......</span></font></div>    <div><font face="f0g40fi+" size="2"><span class="364065717-01022008"></span></font>&nbsp;</div>    <div><font face="f0g40fi+" size="2"><span class="364065717-01022008">====</span></font></div>    <div><font face="f0g40fi+" size="2"><span class="364065717-01022008"></span></font>&nbsp;</div>    <div><font face="f0g40fi+" size="2"><span class="364065717-01022008">Here is the test result when I open     editArticleCategories page: (I test it under&nbsp; php5, apache 2.2 &amp;     mysql5 on a slow pentium M 1.8GHZ with 2G ram with window     xp)</span></font></div>    <div><font face="f0g40fi+" size="2"><span class="364065717-01022008"></span></font>&nbsp;</div>    <div><font face="f0g40fi+" size="2"><span class="364065717-01022008">1. LifeType core + 14 plugins (8 with xml menu     entries setting) : 1000 ms</span></font></div>    <div><font face="f0g40fi+" size="2"><span class="364065717-01022008">2. (1) and remove all locale files :     900ms</span></font></div>    <div><font face="f0g40fi+" size="2"><span class="364065717-01022008">3. (1) and remove all plugins:     550ms</span></font></div>    <div><font face="f0g40fi+" size="2"><span class="364065717-01022008"></span></font>&nbsp;</div>    <div><font face="f0g40fi+" size="2"><span class="364065717-01022008">Just for your reference.</span></font></div>    <div><font face="f0g40fi+" size="2"><span class="364065717-01022008"></span></font>&nbsp;</div>    <div><font face="f0g40fi+" size="2"><span class="364065717-01022008">Mark</span></font></div>    <div><font face="f0g40fi+" size="2"><span class="364065717-01022008"></span></font>&nbsp;</div>    <div><font face="f0g40fi+" size="2"><span class="364065717-01022008"></span></font>&nbsp;</div>    <div><font face="f0g40fi+" size="2"><span class="364065717-01022008"></span></font>&nbsp;</div></div>_______________________________________________<br>pLog-svn     mailing list<br><a href="mailto:pLog-svn@devel.lifetype.net">pLog-svn@devel.lifetype.net</a><br><a href="http://limedaley.com/mailman/listinfo/plog-svn">http://limedaley.com/mailman/listinfo/plog-svn</a></blockquote></div><br></div></div></blockquote></div> _______________________________________________<br>pLog-svn mailing list<br><a href="mailto:pLog-svn@devel.lifetype.net">pLog-svn@devel.lifetype.net</a><br>http://limedaley.com/mailman/listinfo/plog-svn</blockquote></div><br></body></html>