Documentation TYPO3 par Ameos

benchmark.php

00001 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
00002 
00003 <html>
00004 <head>
00005         <title>ADODB Benchmarks</title>
00006 </head> 
00007 
00008 <body>
00009 <?php 
00010 /*
00011 V4.80 8 Mar 2006  (c) 2000-2006 John Lim (jlim@natsoft.com.my). All rights reserved.
00012   Released under both BSD license and Lesser GPL library license. 
00013   Whenever there is any discrepancy between the two licenses, 
00014   the BSD license will take precedence.
00015   
00016   Benchmark code to test the speed to the ADODB library with different databases.
00017   This is a simplistic benchmark to be used as the basis for further testing.
00018   It should not be used as proof of the superiority of one database over the other.
00019 */ 
00020  
00021 $testmssql = true;
00022 //$testvfp = true;
00023 $testoracle = true;
00024 $testado = true; 
00025 $testibase = true;
00026 $testaccess = true;
00027 $testmysql = true;
00028 $testsqlite = true;;
00029 
00030 set_time_limit(240); // increase timeout
00031 
00032 include("../tohtml.inc.php");
00033 include("../adodb.inc.php");
00034 
00035 function testdb(&$db,$createtab="create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)")
00036 {
00037 GLOBAL $ADODB_version,$ADODB_FETCH_MODE;
00038 
00039         adodb_backtrace();
00040         
00041         $max = 100;
00042         $sql = 'select * from ADOXYZ';
00043         $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
00044         
00045         //print "<h3>ADODB Version: $ADODB_version Host: <i>$db->host</i> &nbsp; Database: <i>$db->database</i></h3>";
00046         
00047         // perform query once to cache results so we are only testing throughput 
00048         $rs = $db->Execute($sql);
00049         if (!$rs){
00050                 print "Error in recordset<p>";
00051                 return;
00052         }       
00053         $arr = $rs->GetArray();
00054         //$db->debug = true;
00055         global $ADODB_COUNTRECS;
00056         $ADODB_COUNTRECS = false;
00057         $start = microtime();
00058         for ($i=0; $i < $max; $i++) {
00059                 $rs =& $db->Execute($sql);      
00060                 $arr =& $rs->GetArray();
00061            //            print $arr[0][1];
00062         }
00063         $end =  microtime();
00064         $start = explode(' ',$start);
00065         $end = explode(' ',$end);
00066         
00067         //print_r($start);
00068         //print_r($end);
00069         
00070           //  print_r($arr);
00071         $total = $end[0]+trim($end[1]) - $start[0]-trim($start[1]);
00072         printf ("<p>seconds = %8.2f for %d iterations each with %d records</p>",$total,$max, sizeof($arr));
00073         flush();
00074 
00075 
00076                 //$db->Close();
00077 }
00078 include("testdatabases.inc.php");
00079 
00080 ?>
00081 
00082 
00083 </body>
00084 </html>


Généré par Les experts TYPO3 avec  doxygen 1.4.6