From: Date: March 27 2007 12:55pm Subject: PHP mysqlnd svn commit: r265 - trunk/ext/mysqli/tests List-Archive: http://lists.mysql.com/commits/22996 Message-Id: <200703271055.l2RAtCe6017898@bk-internal.mysql.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Author: ahristov Date: 2007-03-27 12:55:12 +0200 (Tue, 27 Mar 2007) New Revision: 265 Modified: trunk/ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_mysqlnd.phpt trunk/ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_remote_mysqlnd.phpt Log: Make tests more efficient. 100k time concatenating 1024bytes is a bit slow operation! Modified: trunk/ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_mysqlnd.phpt =================================================================== --- trunk/ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_mysqlnd.phpt 2007-03-27 10:54:13 UTC (rev 264) +++ trunk/ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_mysqlnd.phpt 2007-03-27 10:55:12 UTC (rev 265) @@ -45,13 +45,10 @@ // maximum packet size up to which we test is 10M $tmp = ''; $blob = ''; - for ($i = 0; $i < 1024; $i++) { - $tmp .= 'a'; - } + $tmp = str_repeat('a', 1024); - $limit = min(floor($max_allowed_packet / 1024 / 2), 10240); - for ($i = 0; $i < $limit; $i++) - $blob .= $tmp; + $limit = min(floor($max_allowed_packet / 1024 / 2), 10240); + $blob = str_repeat($tmp, $limit); assert(strlen($blob) <= $max_allowed_packet); @@ -68,8 +65,7 @@ // for too long packages without wasting too much memory $limit = $max_allowed_packet - strlen($blob) + 1; $blob2 = $blob; - for ($i = 0; $i < $limit; $i++) - $blob2 .= 'b'; + $blob2 .= str_repeat('b', $limit); assert(strlen($blob2) > $max_allowed_packet); @@ -91,4 +87,4 @@ Warning: mysqli_stmt_send_long_data(): Skipped %d bytes. Last command STMT_SEND_LONG_DATA hasn't consumed all the output from the server in %s on line %d Warning: mysqli_stmt_send_long_data(): There was an error while sending long data. Probably max_allowed_packet_size is smaller than the data. You have to increase it or send smaller chunks of data. Answer was %d bytes long. in %s on line %d -done! \ No newline at end of file +done! Modified: trunk/ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_remote_mysqlnd.phpt =================================================================== --- trunk/ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_remote_mysqlnd.phpt 2007-03-27 10:54:13 UTC (rev 264) +++ trunk/ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_remote_mysqlnd.phpt 2007-03-27 10:55:12 UTC (rev 265) @@ -45,17 +45,13 @@ // maximum packet size up to which we test is 10M $tmp = ''; $blob = ''; - for ($i = 0; $i < 1024; $i++) { - $tmp .= 'a'; - } + $tmp = str_repeat('a', 1024); - $limit = floor($max_allowed_packet / 1024 / 2); - for ($i = 0; $i < $limit; $i++) - $blob .= $tmp; + $limit = floor($max_allowed_packet / 1024 / 2); + $blob = str_repeat($tmp, $limit); - $limit = $max_allowed_packet - strlen($blob) + 1; - for ($i = 0; $i < $limit; $i++) - $blob .= 'b'; + $limit = $max_allowed_packet - strlen($blob) + 1; + $blob .= str_repeat('b', $limit); assert(strlen($blob) > $max_allowed_packet); @@ -77,4 +73,4 @@ Warning: mysqli_stmt_send_long_data(): Skipped %d bytes. Last command STMT_SEND_LONG_DATA hasn't consumed all the output from the server in %s on line %d Warning: mysqli_stmt_send_long_data(): There was an error while sending long data. Probably max_allowed_packet_size is smaller than the data. You have to increase it or send smaller chunks of data. Answer was %d bytes long. in %s on line %d -done! \ No newline at end of file +done!