Partner and Community Forums
PHP 7.2 on IIS extremely slooow . string concat, but everything else...
Re: PHP 7.2 on IIS extremely slooow . string concat, but everything e...
Mar 12, 2019 12:36 PM|niceblue|LINK
And more work ...
I tried adding php://memory buffer method instead of ob_start() buffer ... (less of a hack). And I found it was almost 2x faster even than ob_start! So the difference in performance between this and standard . concatenation is
x600 slower than this method with $n = 300000!! I thought the sql query would be the bottleneck, this is the bottlneck by a really big margin ... ?
php://memory buffer code
$timer = microtime(true);
$handle = fopen("php://memory", "r+");
for ($i = 0; $i < $n; $i++)
fwrite($handle, "(" . 123 . "),");
$output = fread($handle, 1000000);
$fwritetime = microtime(true) - $timer;
echo "php://memory concatenation ", $fwritetime, "s<br>";
echo ($fwritetime / $buffertime), "x difference<br>";