com phpruntests: memory checking tests - to be removed later: src/memorytestSPL.php src/memorytestSPLFilterIterator.php src/memorytestScanDir.php
| From: | David Soria Parra | Date: | Mon, 22 Jun 2009 07:56:40 +0000 |
| Subject: | com phpruntests: memory checking tests - to be removed later: src/memorytestSPL.php src/memorytestSPLFilterIterator.php src/memorytestScanDir.php | ||
| Groups: | php.qa | ||
| Request: | Send a blank email to php-qa+get-66404@lists.php.net to get a copy of this message | ||
Commit: 3b914371cdc3f35309fa9f37f549f70ac099b0b8
Author: Zoe Slattery <zoe@php.net> Mon, 22 Jun 2009 07:56:40 +0000
Parents: 005edcbf7eb46af893b0786a6d036715275ffbfe
Branches: master
Link: http://git.php.net/?p=phpruntests.git;a=commitdiff;h=3b914371cdc3f35309fa9f37f549f70ac099b0b8
Log:
memory checking tests - to be removed later
Changed paths:
A src/memorytestSPL.php
A src/memorytestSPLFilterIterator.php
A src/memorytestScanDir.php
Diff:
diff --git a/src/memorytestSPL.php b/src/memorytestSPL.php
new file mode 100644
index 0000000..1500b59
--- /dev/null
+++ b/src/memorytestSPL.php
@@ -0,0 +1,26 @@
+<?php
+
+include 'rtUtil.php';
+
+$topDir = $argv[1];
+
+
+$s1 = getMicroTime();
+
+$phptDirectoryList= rtUtil::getDirectoryList($topDir);
+
+$s2 = getMicroTime();
+$t0 = $s2 - $s1;
+echo "Time to create using SPL = " . $t0 . "\n";
+
+echo "Memory : " . memory_get_usage() . " bytes \n";
+
+var_dump(count($phptDirectoryList));
+
+
+function getMicrotime(){
+ list($useg,$seg)=explode(' ',microtime());
+ return ((float)$useg+(float)$seg);
+}
+
+?>
diff --git a/src/memorytestSPLFilterIterator.php b/src/memorytestSPLFilterIterator.php
new file mode 100644
index 0000000..4e7dd63
--- /dev/null
+++ b/src/memorytestSPLFilterIterator.php
@@ -0,0 +1,27 @@
+<?php
+
+include 'rtUtil.php';
+include 'rtPhptFilterIterator..php';
+
+$topDir = $argv[1];
+
+
+$s1 = getMicroTime();
+
+$phptDirectoryList= rtUtil::getDirectoryListOld($topDir);
+
+$s2 = getMicroTime();
+$t0 = $s2 - $s1;
+echo "Time to create using SPL = " . $t0 . "\n";
+
+echo "Memory : " . memory_get_usage() . " bytes \n";
+
+var_dump(count($phptDirectoryList));
+
+
+function getMicrotime(){
+ list($useg,$seg)=explode(' ',microtime());
+ return ((float)$useg+(float)$seg);
+}
+
+?>
diff --git a/src/memorytestScanDir.php b/src/memorytestScanDir.php
new file mode 100644
index 0000000..5a1c724
--- /dev/null
+++ b/src/memorytestScanDir.php
@@ -0,0 +1,24 @@
+<?php
+
+include 'rtUtil.php';
+
+$topDir = $argv[1];
+
+
+$s3 = getMicroTime();
+$phptDirectoryList2= rtUtil::parseDir($topDir);
+$s4 = getMicroTime();
+$t1 = $s4 - $s3;
+
+echo "Time to create using scandir = " . $t1 . "\n";
+echo "Memory : " . memory_get_usage() . " bytes \n";
+
+var_dump(count($phptDirectoryList2));
+
+
+function getMicrotime(){
+ list($useg,$seg)=explode(' ',microtime());
+ return ((float)$useg+(float)$seg);
+}
+
+?>