[wp-trac] [WordPress Trac] #22625: Lone less than (<) characters foul up balanceTags()

WordPress Trac noreply at wordpress.org
Tue Dec 4 16:01:28 UTC 2012


#22625: Lone less than (<) characters foul up balanceTags()
--------------------------+------------------------------
 Reporter:  markjaquith   |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:
 Severity:  normal        |  Resolution:
 Keywords:                |
--------------------------+------------------------------

Comment (by devesine):

 As discussed in IRC, performance numbers over 100,000 trials (running
 against the HTML from http://wordpress.org/), using the following code:

 {{{
 $source = file_get_contents('http://wordpress.org/');
 $i = 0;
 $ts_arr = array();
 while ($i < 100000) {
         unset($foo);
         $ts = microtime(true);
         $foo = balanceTags($source);
         $end_ts = microtime(true);
         $ts_arr[] = $end_ts - $ts;
         $i += 1;
 }
 echo "Min: " . min($ts_arr) . PHP_EOL;
 echo "Max: " . max($ts_arr) . PHP_EOL;
 echo "Mean: " . (array_sum($ts_arr) / count($ts_arr)) . PHP_EOL;

 }}}

 Original:

 {{{
 Min: 4.9829483032227E-5
 Max: 0.0089290142059326
 Mean: 5.6982216835022E-5
 }}}

 -2 patch:

 {{{
 Min: 4.9829483032227E-5
 Max: 0.0017969608306885
 Mean: 5.7010720252991E-5
 }}}

 Looks like the performance is pretty solidly comparable.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/22625#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list