|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-05-27 17:26 UTC] sniper@php.net
[2003-05-28 00:56 UTC] webmaster at maczsoftware dot com
[2003-06-29 20:13 UTC] iliaa@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 20:00:01 2025 UTC |
I'm having some pretty weird issues with ob_start() function. I have a merely complex script, which parses XML file (its functionality is located in own class, which is included from another php file). Because this script can output pretty much data, I'm buffering the output and then send it to browser gzipped. However, the execution time of my script is 23 seconds with large XML file, so I started to investigate possibilities of optimization. I thought - of course - that XML parsing was taking too long, but when I started to count seconds with getmicrotime() function, I found out that ob_start("ob_gzhandler") was taking 14 seconds of that 23! So I suppose this could be a bug in the PHP. I'm not saying that the script is too slow, 23 secs can be completely possible, but that calling getmicrotime() right before and right after ob_start() and getting 14 secs can't be right. All data is printed after ob_start() call, and at the end of the script ob_end_flush() is called. I have also tried using non-gzipped output, with pretty same processing time. The code which relates to this problem is below: Code: $before = getmicrotime(); ob_start("ob_gzhandler"); $after = getmicrotime(); // Here comes some XML parsing and printing some large text data // ... print "Time usage for ob_start: " . ($after - $before) . " seconds\n"; ob_end_flush(); // This is standard getmicrotime from php.net function getmicrotime() { list($usec, $sec) = explode(" ",microtime()); return ((float)$usec + (float)$sec); } --- PHP INFO: PHP 4.3.2RC4 (cli) (built: May 22 2003 16:30:41) Copyright (c) 1997-2003 The PHP Group Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies Configure line: ./configure --with-mysql --with-apxs=/usr/local/apache/bin/apxs --with-gd --with-zlib-dir=/usr/local --enable-memory-limit