PageRenderTime 43ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/libraries/adodb.493a/tests/benchmark.php

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