Re: cvs: php4 /ext/standard basic_functions.c incomplete_class.c php_incomplete_class.h var.c /ext/wddx wddx.c

From: Date: Mon, 06 Aug 2001 15:19:05 +0000
Subject: Re: cvs: php4 /ext/standard basic_functions.c incomplete_class.c php_incomplete_class.h var.c /ext/wddx wddx.c
References: 1 2 3 4 5 6 7 8 9 10 11  Groups: php.dev 
Request: Send a blank email to php-dev+get-62276@lists.php.net to get a copy of this message
At 18:07 06/08/2001, Andrei Zmievski wrote:
On Mon, 06 Aug 2001, Zeev Suraski wrote: BTW, there's no good reason not to load all of the extensions you may need in all of your scripts from php.ini. Loading many extensions doesn't pose a significant/noticeable load. Loading using dl() does. Can you explain why the difference matters?
Sure. dl() means that module_init is done multiple times. It also means that module_shutdown is done multiple times, *and* has to take care of cleaning up after the extension *completely*. That is, clean whatever functions, classes, ini entries and callbacks this function may have registered. Right now, only PHP functions and ini entries (to a degree) are handled properly. Drawbacks: - It's slow. We encourage putting expensive operations into the module_init, using dl() means they end up being done multiple times. - Under Apache, it's even worse - since in addition to slowliness, it also ends up consuming significantly more memory, since any memory the extension allocates in module_init (e.g., the function entries it registers) cannot be shared between the processes. - It prevents the engine from optimizing function calls at compile time, by looking at what kind of arguments these functions expect. This is left for run-time, which results in significantly slower run-time performance. - Literally, none of the extensions properly cleans up after itself, leaving PHP in various degrees of instability. This rarely translates to crashes, because people don't usually have a script in which they dl() and then use a class, another script in which they use the class without dl()'ing first, and call the 2nd script right after calling the 1st one. Still, from a cleanliness perspective and in theory, it's bad. - Another buglet resulting from this is the crash in debug mode, in case of a memory leak inside an extension, which is reported in the bugs db. It's no biggy, but also has no good solution. I don't think the solution should be fixing all of the extensions to clean up after themselves, when the only gain is having dl() work, and when using dl() is almost always(*) significantly worse than simply adding the extension to the php.ini file. (*) I can't think of any case in which it isn't, but I'm staying humble :) Zeev

« previous php.dev (#62276) next »