aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/vobject/bin/rrulebench.php
blob: 69008002e333871b9661d83a25b22d6c484561fc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php

include __DIR__.'/../vendor/autoload.php';

if ($argc < 4) {
    echo 'sabre/vobject ', Sabre\VObject\Version::VERSION, " RRULE benchmark\n";
    echo "\n";
    echo "This script can be used to measure the speed of the 'recurrence expansion'\n";
    echo 'system.';
    echo "\n";
    echo 'Usage: '.$argv[0]." inputfile.ics startdate enddate\n";
    exit();
}

list(, $inputFile, $startDate, $endDate) = $argv;

$bench = new Hoa\Bench\Bench();
$bench->parse->start();

echo "Parsing.\n";
$vobj = Sabre\VObject\Reader::read(fopen($inputFile, 'r'));

$bench->parse->stop();

echo "Expanding.\n";
$bench->expand->start();

$vobj->expand(new DateTime($startDate), new DateTime($endDate));

$bench->expand->stop();

echo $bench,"\n";