cvs: php-benchmarks /benchcli/microtests test_array-iterator.php test_array-loop.php
| From: | Olafur Waage | Date: | Wed, 01 Jul 2009 20:36:39 +0000 |
| Subject: | cvs: php-benchmarks /benchcli/microtests test_array-iterator.php test_array-loop.php | ||
| Groups: | php.qa | ||
| Request: | Send a blank email to php-qa+get-65165@lists.php.net to get a copy of this message | ||
olafurw Wed Jul 1 20:36:39 2009 UTC
Modified files:
/php-benchmarks/benchcli/microtests test_array-iterator.php
test_array-loop.php
Log:
Changed the size of the loops from 300k to 20k
http://cvs.php.net/viewvc.cgi/php-benchmarks/benchcli/microtests/test_array-iterator.php?r1=1.1&r2=1.2&diff_format=u
Index: php-benchmarks/benchcli/microtests/test_array-iterator.php
diff -u php-benchmarks/benchcli/microtests/test_array-iterator.php:1.1
php-benchmarks/benchcli/microtests/test_array-iterator.php:1.2
--- php-benchmarks/benchcli/microtests/test_array-iterator.php:1.1 Mon Jun 29 19:23:17 2009
+++ php-benchmarks/benchcli/microtests/test_array-iterator.php Wed Jul 1 20:36:38 2009
@@ -1,26 +1,23 @@
<?php
-$size = 300000;
+$size = 20000;
// create array
-
$testArray = array();
-for ($i=0; $i<$size; $i++) {
-
+for ($i=0; $i<$size; $i++)
+{
$testArray[$i] = rand(0,9);
}
$testObject = new ArrayObject($testArray);
$iterator = $testObject->getIterator();
-while ($iterator->valid()) {
-
- if ($iterator->key()%2 == 0) {
-
- $testObject[$iterator->current()] = 'G';
+while ($iterator->valid())
+{
+ if ($iterator->key() % 2 == 0)
+ {
+ $testObject[$iterator->current()] = 'G';
}
$iterator->next();
-}
-
-?>
+}
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-benchmarks/benchcli/microtests/test_array-loop.php?r1=1.1&r2=1.2&diff_format=u
Index: php-benchmarks/benchcli/microtests/test_array-loop.php
diff -u php-benchmarks/benchcli/microtests/test_array-loop.php:1.1
php-benchmarks/benchcli/microtests/test_array-loop.php:1.2
--- php-benchmarks/benchcli/microtests/test_array-loop.php:1.1 Mon Jun 29 19:23:17 2009
+++ php-benchmarks/benchcli/microtests/test_array-loop.php Wed Jul 1 20:36:38 2009
@@ -1,25 +1,22 @@
<?php
-$size = 300000;
-// create array
+$size = 20000;
+// create array
$testArray = array();
-for ($i=0; $i<$size; $i++) {
-
+for ($i=0; $i<$size; $i++)
+{
$testArray[$i] = rand(0,9);
}
// loop
-
-for ($i=0; $i<$size; $i++) {
-
- if (isset($testArray[$i])) {
-
- if ($i%2 == 0) {
-
+for ($i=0; $i<$size; $i++)
+{
+ if (isset($testArray[$i]))
+ {
+ if ($i%2 == 0)
+ {
$testArray[$i] = 'G';
}
}
-}
-
-?>
+}
\ No newline at end of file