root/branches/gettext/tests/benchmark_concat.php

Revision 2, 0.7 kB (checked in by schst, 5 years ago)

initial import on new server

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 <?PHP
2 /**
3  * simple benchmark to check whether using variables in quoted strings is faster than
4  * concatenating a string. It needs the PEAR::Benchmark_Timer class.
5  *
6  * $Id$
7  *
8  * @package        patForms
9  * @subpackage    Tests
10  * @author        Sebastian Mordziol <argh@php-tool.net>
11  */
12  
13    /**
14     * uses the PEAR::Benchmark_Timer class
15     */
16     require_once 'Benchmark/Timer.php';
17
18     $name    =    'RadioGroup_Option';
19     $type    =    'Element';
20     
21     $timer    =    &new Benchmark_Timer();
22     
23     $timer->start();
24
25     // strpos
26     for( $i = 1; $i <= 5000; $i++ )
27     {
28         $file    =    "$name/$type";
29     }
30     $timer->setMarker( 'quoted' );
31
32     // strstr
33     for( $i = 1; $i <= 5000; $i++ )
34     {
35         $file    =    $name.'/'.$type;
36     }
37     $timer->setMarker( 'concat' );
38
39
40     $timer->stop();
41     $timer->display();
42 ?>
Note: See TracBrowser for help on using the browser.