1
0
mirror of https://github.com/halaxa/json-machine.git synced 2025-01-18 05:28:14 +01:00

Performance testing with debug

This commit is contained in:
Filip Halaxa 2021-12-16 16:55:32 +01:00
parent e75a68acc8
commit 129d59f79f

View File

@ -17,6 +17,12 @@ $decoders = [
'JsonMachine::fromString()' => function ($file) {
return JsonMachine::fromString(stream_get_contents(fopen($file, 'r')));
},
'JsonMachine::fromFile() - debug' => function ($file) {
return JsonMachine::fromFile($file, '', null, true);
},
'JsonMachine::fromString() - debug' => function ($file) {
return JsonMachine::fromString(stream_get_contents(fopen($file, 'r')), '', null, true);
},
'json_decode()' => function ($file) {
return json_decode(stream_get_contents(fopen($file, 'r')), true);
},
@ -37,7 +43,7 @@ foreach ($decoders as $name => $decoder) {
$textResult = round($fileSizeMb/$time, 2) . ' MB/s';
}
echo "$name: $textResult".PHP_EOL;
echo str_pad($name.": ", 37, '.')." $textResult".PHP_EOL;
}
@unlink($tmpJsonFileName);