source: companies/celepar/phpgwapi/inc/adodb/tests/benchmark.php @ 763

Revision 763, 2.0 KB checked in by niltonneto, 15 years ago (diff)

Importação inicial do Expresso da Celepar

Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2
3<html>
4<head>
5        <title>ADODB Benchmarks</title>
6</head>
7
8<body>
9<?php
10/*
11V4.81 3 May 2006  (c) 2000-2007 John Lim (jlim#natsoft.com.my). All rights reserved.
12  Released under both BSD license and Lesser GPL library license.
13  Whenever there is any discrepancy between the two licenses,
14  the BSD license will take precedence.
15 
16  Benchmark code to test the speed to the ADODB library with different databases.
17  This is a simplistic benchmark to be used as the basis for further testing.
18  It should not be used as proof of the superiority of one database over the other.
19*/
20 
21$testmssql = true;
22//$testvfp = true;
23$testoracle = true;
24$testado = true;
25$testibase = true;
26$testaccess = true;
27$testmysql = true;
28$testsqlite = true;;
29
30set_time_limit(240); // increase timeout
31
32include("../tohtml.inc.php");
33include("../adodb.inc.php");
34
35function testdb(&$db,$createtab="create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)")
36{
37GLOBAL $ADODB_version,$ADODB_FETCH_MODE;
38
39        adodb_backtrace();
40       
41        $max = 100;
42        $sql = 'select * from ADOXYZ';
43        $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
44       
45        //print "<h3>ADODB Version: $ADODB_version Host: <i>$db->host</i> &nbsp; Database: <i>$db->database</i></h3>";
46       
47        // perform query once to cache results so we are only testing throughput
48        $rs = $db->Execute($sql);
49        if (!$rs){
50                print "Error in recordset<p>";
51                return;
52        }       
53        $arr = $rs->GetArray();
54        //$db->debug = true;
55        global $ADODB_COUNTRECS;
56        $ADODB_COUNTRECS = false;
57        $start = microtime();
58        for ($i=0; $i < $max; $i++) {
59                $rs =& $db->Execute($sql);     
60                $arr =& $rs->GetArray();
61           //            print $arr[0][1];
62        }
63        $end =  microtime();
64        $start = explode(' ',$start);
65        $end = explode(' ',$end);
66       
67        //print_r($start);
68        //print_r($end);
69       
70          //  print_r($arr);
71        $total = $end[0]+trim($end[1]) - $start[0]-trim($start[1]);
72        printf ("<p>seconds = %8.2f for %d iterations each with %d records</p>",$total,$max, sizeof($arr));
73        flush();
74
75
76                //$db->Close();
77}
78include("testdatabases.inc.php");
79
80?>
81
82
83</body>
84</html>
Note: See TracBrowser for help on using the repository browser.