com php-src: Another try at making concat_003 more reliable: Zend/tests/concat_003.phpt

From: Date: Thu, 29 Dec 2016 20:39:40 +0000
Subject: com php-src: Another try at making concat_003 more reliable: Zend/tests/concat_003.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-96443@lists.php.net to get a copy of this message
Commit: 432660f73f929b560d5f9c3d5466e3a2aee42851 Author: Nikita Popov <nikic@php.net> Thu, 29 Dec 2016 21:39:40 +0100 Parents: 78675ebd9adbc050718ed5aeea6149e097334008 Branches: PHP-7.0 PHP-7.1 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=432660f73f929b560d5f9c3d5466e3a2aee42851 Log: Another try at making concat_003 more reliable 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. Changed paths: M Zend/tests/concat_003.phpt Diff: diff --git a/Zend/tests/concat_003.phpt b/Zend/tests/concat_003.phpt index 53d8d2f..13c6fdc 100644 --- a/Zend/tests/concat_003.phpt +++ b/Zend/tests/concat_003.phpt @@ -2,37 +2,24 @@ Concatenating many small strings should not slowdown allocations --SKIPIF-- <?php if (PHP_DEBUG) { die ("skip debug version is slow"); } ?> ---INI-- -memory_limit=256m --FILE-- <?php -/* To note is that memory usage can vary depending on whether opcache is on. The actual - measuring that matters is timing here. */ - $time = microtime(TRUE); /* This might vary on Linux/Windows, so the worst case and also count in slow machines. */ -$t0_max = 0.3; -$t1_max = 1.0; - -$datas = []; -for ($i = 0; $i < 220000; $i++) -{ - $datas[] = [ - '000.000.000.000', - '000.255.255.255', - '保留地址', - '保留地址', - '保留地址', - '保留地址', - '保留地址', - '保留地址', - ]; -} - -$t0 = microtime(TRUE) - $time; -var_dump($t0 < $t0_max); +$t_max = 1.0; + +$datas = array_fill(0, 220000, [ + '000.000.000.000', + '000.255.255.255', + '保留地址', + '保留地址', + '保留地址', + '保留地址', + '保留地址', + '保留地址', +]); $time = microtime(TRUE); $texts = ''; @@ -41,12 +28,11 @@ foreach ($datas AS $data) $texts .= implode("\t", $data) . "\r\n"; } -$t1 = microtime(TRUE) - $time; -var_dump($t1 < $t1_max); +$t = microtime(TRUE) - $time; +var_dump($t < $t_max); ?> +++DONE+++ --EXPECT-- bool(true) -bool(true) +++DONE+++

« previous php.cvs (#96443) next »