From: <pdo...@an...> - 2003-02-18 09:45:06
|
First off, let me clarify my position by saying that I had been making th= e assumption that the hooks array would be static, pre-built at compile time... >> There was two ideas Erin and I were mulling over, and possibly >> reviewing. Both of them came up because of our working on some >> optimization of code. The problem both of us noted that during the >> running of each page, the plugin section gets called every time. When >> this occurs, the plugin.php code scans through each >> plugin_dir/setup.php file, and tries finding out the relevant hooks >> for that plugin, and building it into an array. There are, as you may >> see immediately, some problems with this. >> >> The first being, setup.php is loaded every time. And I was taking this one step further in that there technically is no need to include a bunch of plugins in a given request if the hooks that will be called during the request have nothing to do with them. If we ca= n get all authors to trim down their setup.php's substantially, this might not save much, but every bit does count. So, taking all this to its extreme, we'd have something like: Similar to what Jimmy suggested (make a separate array per hook), I would suggest that we could instead let conf.pl build one file for each hook, inside of that file would simply be a list of includes for all plugins registered against that hook: squirrelmail/plugin-conf/optpage_register_block.php squirrelmail/plugin-conf/webmail_top.php etc. The contents of one of these files might be: <?php include_once(SM_PATH . 'plugins/address_add/setup.php'); include_once(SM_PATH . 'plugins/folder_sizes/setup.php'); include_once(SM_PATH . 'plugins/vlogin/setup.php'); ?> The last step would be to make sure that each source file had an include call for each of the hooks it uses: in webmail.php: include_once(SM_PATH . 'plugin-conf/webmail_top.php'); include_once(SM_PATH . 'plugin-conf/webmail_bottom.php'); That, along with smaller setup.php files, might speed things up quite a bit. The only thing I can think of that would be faster, but a little more messier would be to let conf.pl put the includes of the actual plugins directly in each of the source files, thereby eliminating the intermediate file that had nothing but includes in it. What say you folks? BTW, Jimmy, take a peek at the beginning of this thread at the bottom... about plugin review board ideas... have you any thoughts on this stuff? Cheers (i'm offline tomorrow), paul |