ID: 33070 User updated by: lindsay at bitleap dot com Reported By: lindsay at bitleap dot com -Status: Feedback +Status: Open Bug Type: Performance problem Operating System: Linux 2.6.10 kernel PHP Version: 5.0.3 New Comment:
It looks like BZ2_bzRead() requires a file to read from. Would: BZ2_bzDecompressInit loop BZ2_bzDecompress //decompress in chunks BZ2_bzDecompressEnd work? The source code for BZ2_bzBuffToBuffDecompress seems like it could almost be used if the BZ2_bzDecompress was looped through 'source' in chunks. Previous Comments: ------------------------------------------------------------------------ [2005-05-23 10:02:56] [EMAIL PROTECTED] jeff at vertexdev dot com: Yes. And now look at the code. ------------------------------------------------------------------------ [2005-05-23 00:40:16] jeff at vertexdev dot com The fix is really easy. In function bzdecompress, you need to do the following: 1. Before the 'do' loop, initialize size to some reasonable value: size = PHP_BZ_DECOMPRESS_SIZE; 2. Inside of the loop, double the size each time (replace the existing 'size = dest_len * iter;' statement with this): size *= 2; This will temporarily use up a little bit more memory than stricly necessary, but it will make the function usable. Drop me an email if you need more information. ------------------------------------------------------------------------ [2005-05-22 22:04:49] [EMAIL PROTECTED] Yes, this is possibel with the BZ2_bzRead() api call. ------------------------------------------------------------------------ [2005-05-22 20:56:20] lindsay at bitleap dot com Given that bzip can be used in a stream, could the data be decompressed in chunks? ------------------------------------------------------------------------ [2005-05-22 15:20:22] [EMAIL PROTECTED] And how do you think it should work? I don't see any more effective way that will not hit memory instead of CPU usage. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/33070 -- Edit this bug report at http://bugs.php.net/?id=33070&edit=1