| 
<?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 />
 |