ID: 48403 Updated by: [email protected] Reported By: gregor at hostgis dot com -Status: Open +Status: Feedback Bug Type: Performance problem Operating System: Linux PHP Version: 5.2.9 New Comment:
Works fine for me. You should really use 2 decimals for the time. I got 0.044s without PHP, 0.04s with PHP.. Previous Comments: ------------------------------------------------------------------------ [2009-05-27 07:37:57] gregor at hostgis dot com Description: ------------ Commands executed via shell_exec() take a lot longer to run than when run directly from the Unix shell. In the example code below, a task that takes 0.5-0.7 seconds takes 5 seconds. This effect is reliable, and a given task's "how much longer it takes than it should" ratio seems constant. In the simple case below, it takes 8-10 times longer than it should. For a specific more complex test case at our side, the task consistently takes 14 seconds from shell and 83 seconds from shell_exec() This effect is apparently identical for the entire family of process-handling functions: passthru, exec, shell_exec, and popen all show the exact same "slowness multipliers" as described above. This report may be similar to http://bugs.php.net/bug.php?id=15746 However, this is for Linux systems and not specific to Windows NT or NETPBM. Reproduce code: --------------- <?php // gdal_translate converts GIS data // in this case, simply copy a GeoTIFF with no transforms $command = 'gdal_translate /tmp/in.tif /tmp/out.tif'; $t0 = microtime(true); exec($command); $t1 = microtime(true); printf("%.1f seconds", $t1 - $t0); ?> Expected result: ---------------- When run from the shell, this takes 0.5 to 0.7 seconds. Actual result: -------------- This takes 5.0-5.5 seconds. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=48403&edit=1
