mirror of
https://github.com/php/php-src.git
synced 2024-12-15 04:45:03 +08:00
432660f73f
Use array_fill() for the array population loop -- this isn't the part that is being tested and on PHP 7.0 w/o opcache this duplicates the inner array a lot.
39 lines
716 B
PHP
39 lines
716 B
PHP
--TEST--
|
|
Concatenating many small strings should not slowdown allocations
|
|
--SKIPIF--
|
|
<?php if (PHP_DEBUG) { die ("skip debug version is slow"); } ?>
|
|
--FILE--
|
|
<?php
|
|
|
|
$time = microtime(TRUE);
|
|
|
|
/* This might vary on Linux/Windows, so the worst case and also count in slow machines. */
|
|
$t_max = 1.0;
|
|
|
|
$datas = array_fill(0, 220000, [
|
|
'000.000.000.000',
|
|
'000.255.255.255',
|
|
'保留地址',
|
|
'保留地址',
|
|
'保留地址',
|
|
'保留地址',
|
|
'保留地址',
|
|
'保留地址',
|
|
]);
|
|
|
|
$time = microtime(TRUE);
|
|
$texts = '';
|
|
foreach ($datas AS $data)
|
|
{
|
|
$texts .= implode("\t", $data) . "\r\n";
|
|
}
|
|
|
|
$t = microtime(TRUE) - $time;
|
|
var_dump($t < $t_max);
|
|
|
|
?>
|
|
+++DONE+++
|
|
--EXPECT--
|
|
bool(true)
|
|
+++DONE+++
|