31273a362b7c58e5b444baee34fc646f35dfc495.svn-base 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. // $Rev: 130 $
  3. // -----------------------------------------------------------------------------
  4. error_reporting(E_ALL);
  5. include_once('../../simple_html_dom_reader.php');
  6. $all = 0;
  7. $min = 10000;
  8. $max = 0;
  9. $count = 20;
  10. $str = file_get_contents('../html/google.htm');
  11. $dom = new simple_html_dom;
  12. for ($i=0; $i<$count; ++$i) {
  13. $start = microtime();
  14. $dom->load($str, false);
  15. list($eu, $es) = explode(' ', microtime());
  16. list($bu, $bs) = explode(' ', $start);
  17. if (((float)$eu+(float)$es-(float)$bu-(float)$bs)*1000 > $max)
  18. $max = ((float)$eu+(float)$es-(float)$bu-(float)$bs)*1000;
  19. if (((float)$eu+(float)$es-(float)$bu-(float)$bs)*1000 < $min)
  20. $min = ((float)$eu+(float)$es-(float)$bu-(float)$bs)*1000;
  21. $all += ((float)$eu+(float)$es-(float)$bu-(float)$bs)*1000;
  22. echo sprintf('(%.1f)', ((float)$eu+(float)$es-(float)$bu-(float)$bs)*1000).'<br>';
  23. $dom->clear();
  24. }
  25. echo '<br>-------------------------<br>';
  26. echo 'min: ' . $min . '<br>';
  27. echo 'max: ' . $max . '<br>';
  28. echo '<br>avg: ' . $all/$count . '<br>';
  29. ?>