3d11872c682c45cf1f6627afa4bdbfc337d83e61.svn-base 753 B

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