rrulebench.php 737 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. include __DIR__.'/../vendor/autoload.php';
  3. if ($argc < 4) {
  4. echo 'sabre/vobject ', Sabre\VObject\Version::VERSION, " RRULE benchmark\n";
  5. echo "\n";
  6. echo "This script can be used to measure the speed of the 'recurrence expansion'\n";
  7. echo 'system.';
  8. echo "\n";
  9. echo 'Usage: '.$argv[0]." inputfile.ics startdate enddate\n";
  10. exit();
  11. }
  12. list(, $inputFile, $startDate, $endDate) = $argv;
  13. $bench = new Hoa\Bench\Bench();
  14. $bench->parse->start();
  15. echo "Parsing.\n";
  16. $vobj = Sabre\VObject\Reader::read(fopen($inputFile, 'r'));
  17. $bench->parse->stop();
  18. echo "Expanding.\n";
  19. $bench->expand->start();
  20. $vobj->expand(new DateTime($startDate), new DateTime($endDate));
  21. $bench->expand->stop();
  22. echo $bench,"\n";