aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/vobject/bin/bench_manipulatevcard.php
diff options
context:
space:
mode:
authorManuel Jiménez Friaza <mjfriaza@openmailbox.org>2019-05-19 13:25:00 +0200
committerManuel Jiménez Friaza <mjfriaza@openmailbox.org>2019-05-19 13:25:00 +0200
commit429140df97a2c273fba6974147ac2e48e7688263 (patch)
tree2e337542da1b0f4c9c383dfeb8a7d9eb63990a72 /vendor/sabre/vobject/bin/bench_manipulatevcard.php
parentf92d2e3f7c6573bd7bab04223c7e28662605c6d8 (diff)
parentaf2b263bc74b16601ec7c123a58f0549613aed27 (diff)
downloadvolse-hubzilla-429140df97a2c273fba6974147ac2e48e7688263.tar.gz
volse-hubzilla-429140df97a2c273fba6974147ac2e48e7688263.tar.bz2
volse-hubzilla-429140df97a2c273fba6974147ac2e48e7688263.zip
Merge remote-tracking branch 'upstream/dev' into dev
Diffstat (limited to 'vendor/sabre/vobject/bin/bench_manipulatevcard.php')
-rw-r--r--vendor/sabre/vobject/bin/bench_manipulatevcard.php39
1 files changed, 17 insertions, 22 deletions
diff --git a/vendor/sabre/vobject/bin/bench_manipulatevcard.php b/vendor/sabre/vobject/bin/bench_manipulatevcard.php
index adc198e9b..f229091db 100644
--- a/vendor/sabre/vobject/bin/bench_manipulatevcard.php
+++ b/vendor/sabre/vobject/bin/bench_manipulatevcard.php
@@ -1,15 +1,15 @@
<?php
-include __DIR__ . '/../vendor/autoload.php';
+include __DIR__.'/../vendor/autoload.php';
if ($argc < 2) {
- echo "sabre/vobject ", Sabre\VObject\Version::VERSION, " manipulation benchmark\n";
+ echo 'sabre/vobject ', Sabre\VObject\Version::VERSION, " manipulation benchmark\n";
echo "\n";
echo "This script can be used to measure the speed of opening a large amount of\n";
echo "vcards, making a few alterations and serializing them again.\n";
- echo "system.";
+ echo 'system.';
echo "\n";
- echo "Usage: " . $argv[0] . " inputfile.vcf\n";
+ echo 'Usage: '.$argv[0]." inputfile.vcf\n";
die();
}
@@ -22,18 +22,21 @@ $splitter = new Sabre\VObject\Splitter\VCard($input);
$bench = new Hoa\Bench\Bench();
while (true) {
-
$bench->parse->start();
$vcard = $splitter->getNext();
$bench->parse->pause();
- if (!$vcard) break;
+ if (!$vcard) {
+ break;
+ }
$bench->manipulate->start();
$vcard->{'X-FOO'} = 'Random new value!';
$emails = [];
- if (isset($vcard->EMAIL)) foreach ($vcard->EMAIL as $email) {
- $emails[] = (string)$email;
+ if (isset($vcard->EMAIL)) {
+ foreach ($vcard->EMAIL as $email) {
+ $emails[] = (string) $email;
+ }
}
$bench->manipulate->pause();
@@ -42,28 +45,20 @@ while (true) {
$bench->serialize->pause();
$vcard->destroy();
-
}
-
-
echo $bench,"\n";
-function formatMemory($input) {
-
+function formatMemory($input)
+{
if (strlen($input) > 6) {
-
- return round($input / (1024 * 1024)) . 'M';
-
+ return round($input / (1024 * 1024)).'M';
} elseif (strlen($input) > 3) {
-
- return round($input / 1024) . 'K';
-
+ return round($input / 1024).'K';
}
-
}
unset($input, $splitter);
-echo "peak memory usage: " . formatMemory(memory_get_peak_usage()), "\n";
-echo "current memory usage: " . formatMemory(memory_get_usage()), "\n";
+echo 'peak memory usage: '.formatMemory(memory_get_peak_usage()), "\n";
+echo 'current memory usage: '.formatMemory(memory_get_usage()), "\n";