3include __DIR__ .
'/../vendor/autoload.php';
8 echo
"This script can be used to measure the speed of opening a large amount of\n";
9 echo
"vcards, making a few alterations and serializing them again.\n";
12 echo
"Usage: " .
$argv[0] .
" inputfile.vcf\n";
16list(, $inputFile) =
$argv;
18$input = file_get_contents($inputFile);
32 $bench->manipulate->start();
33 $vcard->{
'X-FOO'} =
'Random new value!';
35 if (isset($vcard->EMAIL))
foreach ($vcard->EMAIL as
$email) {
36 $emails[] = (string)
$email;
38 $bench->manipulate->pause();
40 $bench->serialize->start();
41 $vcard2 = $vcard->serialize();
42 $bench->serialize->pause();
56 return round(
$input / (1024 * 1024)) .
'M';
58 } elseif (strlen(
$input) > 3) {
60 return round(
$input / 1024) .
'K';
68echo
"peak memory usage: " .
formatMemory(memory_get_peak_usage()),
"\n";
69echo
"current memory usage: " .
formatMemory(memory_get_usage()),
"\n";
An exception for terminatinating execution or to throw for unit testing.
const VERSION
Full version number.