ID: 50652 Updated by: [email protected] Reported By: robert_xp at gmx dot net -Status: Wont fix +Status: Analyzed Bug Type: Performance problem PHP Version: 5.3.1 New Comment:
I'm not completely against this one. At Yahoo we replaced the expensive gettimeofday syscalls with a fast system-wide replacement so it wasn't just PHP that benefitted. They are not insignificant and since the bulk of scripts do run as quick web requests where it is perfectly fine for all time calls to get the request timestamp, and sometimes it even fixes edge-case bugs when they do, so the idea of having some sort switch to enable this optimization is not bad. We would probably have to keep the default as it is though to avoid any BC breaks. Previous Comments: ------------------------------------------------------------------------ [2010-01-04 15:26:50] robert_xp at gmx dot net I'm such an idiot. Sorry, fixed. ------------------------------------------------------------------------ [2010-01-04 15:19:35] [email protected] Your patch it also reversed. ------------------------------------------------------------------------ [2010-01-04 15:11:49] robert_xp at gmx dot net Yes, that's right. I think this is the only point, that speaks really against this solution but most scripts should be executed in < 0.x sec and calling time(NULL) many times can be optimized this way. A good improvement could be, applying the patch and change the SAPI handling to check against a config variable if a optimized time handling should be used - with default using the old approach. ------------------------------------------------------------------------ [2010-01-04 12:25:31] [email protected] We can't do this, as for longer running scripts the value as returned by time() can change (like once every second). ------------------------------------------------------------------------ [2010-01-04 12:18:06] robert_xp at gmx dot net Description: ------------ Sure, it is not so critical to patch this but you use ever time(NULL) to get the current time in most functions. There is a better way going over the SAPI interface and retrieve a cached value. I published also a patch for all time(NULL/0) calls on http://www.xarg.org/2009/12/php-hacking/ I also hacked the FCGI sapi to get the time value direclty from the webserver - yes it is not supported by default. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=50652&edit=1
