php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #53482
Patch is_this_a_patch revision 2010-12-06 10:38 UTC by iradu at unix-world dot org

Patch is_this_a_patch for MySQLi related Bug #53482

Patch version 2010-12-06 10:38 UTC

Return to Bug #53482 | Download this patch
Patch Revisions:

Developer: iradu@unix-world.org

--- php code
echo 'object:<br>';
for($y=0;$y<10;++$y){
$mtime='';$starttime='';$isql=array();$mysqli='';$i=1;$query='';$array=array();$result='';$row=array();
$mtime = explode(' ',microtime());$mtime = (float)$mtime[1] + (float)$mtime[0];$starttime = $mtime;
include 'isett.iphp';
$mysqli=new mysqli($isql['h'],$isql['u'],$isql['p'],$isql['d']);
if(mysqli_connect_errno()) die('Connection Error '.mysqli_connect_errno().' : '.mysqli_connect_error());
$mysqli->set_charset('utf8');

$mysqli->query("CREATE TABLE IF NOT EXISTS persad_dsa (`id` SMALLINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,`a_name` VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,`a_desc` VARCHAR(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,PRIMARY KEY(`id`))ENGINE=MYISAM");

for($i=1;$i<2000;++$i){
  $mysqli->query('INSERT INTO persad_dsa (a_name,a_desc) VALUES(\'=+=+=+=+=+'.($i+1000).'+=+=+=+=+=\',\'------------------------------------------------'.($i+321).'-------\')');
}

$query="SELECT * FROM persad_dsa";
if($result=$mysqli->query($query)){
  while($row=$result->fetch_assoc()){
	$array[]='|-'.$row['id'].'|'.$row['a_name'].'|'.$row['a_desc'].'-|';
  }
  $result->close();
}
$mysqli->query("DROP TABLE IF EXISTS persad_dsa");
$mysqli->close();
$mtime = explode(' ',microtime());$mtime = (float)$mtime[1] + (float)$mtime[0];echo $mtime-$starttime.'<br>';
$mtime='';$starttime='';$isql=array();$mysqli='';$i=1;$query='';$array=array();$result='';$row=array();
}
echo '---<br>procedural:<br>';
for($y=0;$y<10;++$y){
$mtime='';$starttime='';$isql=array();$mysqli='';$i=1;$query='';$array=array();$result='';$row=array();
$mtime = explode(' ',microtime());$mtime = (float)$mtime[1] + (float)$mtime[0];$starttime = $mtime;
include 'isett.iphp';
$mysqli=mysqli_connect($isql['h'],$isql['u'],$isql['p'],$isql['d']);
if(mysqli_connect_errno()) die('Connection Error '.mysqli_connect_errno().' : '.mysqli_connect_error());
mysqli_set_charset($mysqli,'utf8');

mysqli_query($mysqli,"CREATE TABLE IF NOT EXISTS persad_dsa (`id` SMALLINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,`a_name` VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,`a_desc` VARCHAR(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,PRIMARY KEY(`id`))ENGINE=MYISAM");

for($i=1;$i<2000;++$i){
  mysqli_query($mysqli,'INSERT INTO persad_dsa (a_name,a_desc) VALUES(\'=+=+=+=+=+'.($i+1000).'+=+=+=+=+=\',\'------------------------------------------------'.($i+321).'-------\')');
}

$query="SELECT * FROM persad_dsa";
if($result=mysqli_query($mysqli,$query)){
  while($row=mysqli_fetch_assoc($result)){
	$array[]='|-'.$row['id'].'|'.$row['a_name'].'|'.$row['a_desc'].'-|';
  }
  mysqli_free_result($result);
}
mysqli_query($mysqli,"DROP TABLE IF EXISTS persad_dsa");
mysqli_close($mysqli);
$mtime = explode(' ',microtime());$mtime = (float)$mtime[1] + (float)$mtime[0];echo $mtime-$starttime.'<br>';
$mtime='';$starttime='';$isql=array();$mysqli='';$i=1;$query='';$array=array();$result='';$row=array();
}

---



--- php code
echo 'procedural:<br>';
for($y=0;$y<10;++$y){
$mtime='';$starttime='';$isql=array();$mysqli='';$i=1;$query='';$array=array();$result='';$row=array();
$mtime = explode(' ',microtime());$mtime = (float)$mtime[1] + (float)$mtime[0];$starttime = $mtime;
include 'isett.iphp';
$mysqli=mysqli_connect($isql['h'],$isql['u'],$isql['p'],$isql['d']);
if(mysqli_connect_errno()) die('Connection Error '.mysqli_connect_errno().' : '.mysqli_connect_error());
mysqli_set_charset($mysqli,'utf8');

mysqli_query($mysqli,"CREATE TABLE IF NOT EXISTS persad_dsa (`id` SMALLINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,`a_name` VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,`a_desc` VARCHAR(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,PRIMARY KEY(`id`))ENGINE=MYISAM");

for($i=1;$i<2000;++$i){
  mysqli_query($mysqli,'INSERT INTO persad_dsa (a_name,a_desc) VALUES(\'=+=+=+=+=+'.($i+1000).'+=+=+=+=+=\',\'------------------------------------------------'.($i+321).'-------\')');
}

$query="SELECT * FROM persad_dsa";
if($result=mysqli_query($mysqli,$query)){
  while($row=mysqli_fetch_assoc($result)){
	$array[]='|-'.$row['id'].'|'.$row['a_name'].'|'.$row['a_desc'].'-|';
  }
  mysqli_free_result($result);
}
mysqli_query($mysqli,"DROP TABLE IF EXISTS persad_dsa");
mysqli_close($mysqli);
$mtime = explode(' ',microtime());$mtime = (float)$mtime[1] + (float)$mtime[0];echo $mtime-$starttime.'<br>';
$mtime='';$starttime='';$isql=array();$mysqli='';$i=1;$query='';$array=array();$result='';$row=array();
}
echo '---<br>object:<br>';
for($y=0;$y<10;++$y){
$mtime='';$starttime='';$isql=array();$mysqli='';$i=1;$query='';$array=array();$result='';$row=array();
$mtime = explode(' ',microtime());$mtime = (float)$mtime[1] + (float)$mtime[0];$starttime = $mtime;
include 'isett.iphp';
$mysqli=new mysqli($isql['h'],$isql['u'],$isql['p'],$isql['d']);
if(mysqli_connect_errno()) die('Connection Error '.mysqli_connect_errno().' : '.mysqli_connect_error());
$mysqli->set_charset('utf8');

$mysqli->query("CREATE TABLE IF NOT EXISTS persad_dsa (`id` SMALLINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,`a_name` VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,`a_desc` VARCHAR(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,PRIMARY KEY(`id`))ENGINE=MYISAM");

for($i=1;$i<2000;++$i){
  $mysqli->query('INSERT INTO persad_dsa (a_name,a_desc) VALUES(\'=+=+=+=+=+'.($i+1000).'+=+=+=+=+=\',\'------------------------------------------------'.($i+321).'-------\')');
}

$query="SELECT * FROM persad_dsa";
if($result=$mysqli->query($query)){
  while($row=$result->fetch_assoc()){
	$array[]='|-'.$row['id'].'|'.$row['a_name'].'|'.$row['a_desc'].'-|';
  }
  $result->close();
}
$mysqli->query("DROP TABLE IF EXISTS persad_dsa");
$mysqli->close();
$mtime = explode(' ',microtime());$mtime = (float)$mtime[1] + (float)$mtime[0];echo $mtime-$starttime.'<br>';
$mtime='';$starttime='';$isql=array();$mysqli='';$i=1;$query='';$array=array();$result='';$row=array();
}
---


procedural:
0.682552099228
0.464617013931
0.490931034088
0.447603940964
0.492651939392
0.483375072479
0.504446983337
0.488202095032
0.474863052368
0.482882022858
______________
0.5012125254
---
object:
0.439932107925
0.438354969025
0.428317070007
0.442404985428
0.442044973373
0.450672864914
0.425189971924
0.442571878433
0.427703142166
0.427068948746
______________
0.4364260912


procedural:
0.498822927475
0.456892967224
0.450288057327
0.446386098862
0.464179992676
0.470333099365
0.459476947784
0.463217973709
0.444230079651
0.466094017029
______________
0.4619922161
---
object:
0.451704978943
0.450787067413
0.442464828491
0.451838970184
0.500449895859
0.503927946091
0.567903995514
0.498856067657
0.509907960892
0.464576005936
______________
0.4842417717


object:
0.712810993195
0.46958899498
0.457010984421
0.455898046494
0.508882045746
0.45121383667
0.443696975708
0.455738067627
0.459833145142
0.48529791832
______________
0.4899971008
---
procedural:
0.473474025726
0.494134187698
0.459471940994
0.473254919052
0.470777988434
0.50800204277
0.50657081604
0.477627038956
0.454518079758
0.445244073868
______________
0.4763075113


object:
0.584923028946
0.547205924988
0.483695983887
0.450005054474
0.450945854187
0.457696914673
0.442692995071
0.493937969208
0.493886947632
0.477154016495
______________
0.488214469
---
procedural:
0.419256925583
0.428467035294
0.431293010712
0.437885046005
0.480365991592
0.429268121719
0.434899091721
0.443602085114
0.425256967545
0.433305025101
______________
0.43635993


Procedural:
test 1: 0.5012125254
test 2: 0.4619922161
test 3: 0.4763075113
test 4: 0.43635993
Object:
test 1: 0.4364260912
test 2: 0.4842417717
test 3: 0.4899971008
test 4: 0.488214469

Procedural wins 3 of 4 tests, object oriented wins 1 of 4 tests.

Post what you think about all this.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 21 11:01:27 2024 UTC