benchmark.php 403 B

123456789101112131415161718192021222324
  1. <?php
  2. require __DIR__ . '/../src/UserAgentParser.php';
  3. $time = microtime(true);
  4. $uas = json_decode(file_get_contents(__DIR__ . '/../tests/user_agents.json'), true);
  5. foreach( $uas as $ua => $junk ) {
  6. $uatime = microtime(true);
  7. for( $i = 0; $i <= 1000; $i++ ) {
  8. \parse_user_agent($ua);
  9. }
  10. echo microtime(true) - $uatime;
  11. echo " : $ua\n";
  12. }
  13. echo microtime(true) - $time;
  14. echo " : TOTAL\n";