From:             tim at timcrider dot com
Operating system: Red Hat 8.0
PHP version:      4.3.2RC1
PHP Bug Type:     Performance problem
Bug description:  Split hangs on something that 'file' does quickly

split hangs for some reason, but doing the same logical process with other
functions returns a very quick result.

The problem is that I'm trying to process the mysqlbinlog output and parse
it for easier management. The logical process is as follows.

$sys = `mysqlbinlog logfile`;

This part works fine, but when I try:

$lstk = split("\n", $sys);

the script hangs for well over 5 minutes (I kill the script at that time.
However this code produces the desired results in less than 2 seconds:

 $mybin     = "/usr/local/mysql/bin/mysqlbinlog";
 $mylogpath = "/var/lib/mysql/";

 $dolog = $mylogpath."towely-bin.010";

 $tmpfname = tempnam ("/tmp", "mybinlogger");   
 $fp = fopen($fp, $tmpfname);
 fwrite($fp, `$mybin $dolog`);
 fclose($fp);
 
 $lstk = file($tmpfname);
 unset($tmpfname);
 print count($lstk)."\n";

I am using this from the command line version of php 4.3.2 RC1. Here is my
php -v:

PHP 4.3.2-RC1 (cli) (built: Mar 14 2003 13:28:33)
Copyright (c) 1997-2003 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies
    with the ionCube PHP Accelerator v1.3.3r2, Copyright (c) 2001-2002, by
Nick Lindridge


 If you need any other information please feel free to contact me at
[EMAIL PROTECTED]
-- 
Edit bug report at http://bugs.php.net/?id=22744&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=22744&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=22744&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=22744&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=22744&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=22744&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=22744&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=22744&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=22744&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=22744&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=22744&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22744&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=22744&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=22744&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=22744&r=gnused

Reply via email to