Login   Register  
PHP Classes
elePHPant
Icontem

File: tests/test_01.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Pierpaolo  >  INI Manager Improved  >  tests/test_01.php  >  Download  
File: tests/test_01.php
Role: Example script
Content type: text/plain
Description: A test between the original implementation and this one.
Class: INI Manager Improved
Manipulate configuration files in the INI format
Author: By
Last change: Little bugfix (sorry)
Date: 2008-11-27 13:02
Size: 1,651 bytes
 

Contents

Class file image Download
<?php
// This is a simple use of the Alessandro Rosa class (Ini Manager)
// echo get_params_ini( "One", "opt2", "test.ini" ) ;
//
// This file would compare the performance for a simple parsing and one entry search
// between the two version.
//
// Please put the Alessandro Rosa package and this class into the same folder of this
// file.
// Than create "test1.ini" and "test2.ini" file and insert into the same content.
// This can avoid performance fake avaluation based on a cache system.
// If you want use the file "test1.ini.example" provided in this packege.

require_once( "ini_fn.php" );
require_once( 
"IniManagerI.class.php" );

$numUsers=50;

$time1 microtime();

for(
$k=0;$k<$numUsers$k++){
    
$iniManagerI = new IniManagerI("test2.ini");
    
$iniManagerI->parse_ini_file();
    
$iniManagerI->get_entry"One""opt2" ) ;
}

$time2 microtime();

for(
$k=0;$k<$numUsers$k++){
    
$ini_path "test.ini";
    
$iniMANAGER = new ini_manager();
    
$iniMANAGER->parse_ini_file($ini_path);
    
$iniMANAGER->get_entry$ini_path"One""opt2" ) ;
}

$time3 microtime();

function 
microSecondiEffettivi($millitime){
    
$timearray explode(" "$millitime);
    
$microtime=($timearray[1] + $timearray[0])*1000;
    return 
$microtime;
}

?>

<br><br>
Microseconds (improved): <?=microSecondiEffettivi($time2)-microSecondiEffettivi($time1)?> (<?=(microSecondiEffettivi($time2)-microSecondiEffettivi($time1))/1000?> milliseconds)<br /> 
Microseconds (standard): <?=microSecondiEffettivi($time3)-microSecondiEffettivi($time2)?> (<?=(microSecondiEffettivi($time3)-microSecondiEffettivi($time2))/1000?> milliseconds)<br />