<?php require 'speed-bootstrap.php'; use Gdbots\Pbj\Serializer\JsonSerializer; $startTime = microtime(true); $i = 0; $message = createEmailMessage(); $serializer = new JsonSerializer(); do { $i++; $json = $serializer->serialize($message); $message = $serializer->deserialize($json); } while ($i < numTimes()); echo $serializer->serialize($message, ['json_encode_options' => JSON_PRETTY_PRINT]) . PHP_EOL; // speed report $benchmark = microtime(true) - $startTime; $seconds = number_format($benchmark, 6); $totalMessages = numTimes(); $perSecond = floor($totalMessages / $benchmark); $perMinute = $perSecond * 60; $perHour = $perMinute * 60; $perSecond = number_format($perSecond); $perMinute = number_format($perMinute); $perHour = number_format($perHour); $report = <<<STRING Total Time: {$seconds} seconds Messages Processed: {$totalMessages}
<?php ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); require __DIR__ . '/../vendor/autoload.php'; use Gdbots\Pbj\Serializer\JsonSerializer; // verifying json with PHP message if (isset($_REQUEST['verify'])) { $json = file_get_contents('php://input'); try { $serializer = new JsonSerializer(); $message = $serializer->deserialize($json); var_dump($message); } catch (\Exception $e) { echo $e->getMessage(); } exit(1); } ?> <script src="js/json-schema-faker.min.js"></script> <script src="js/ref-parser.min.js"></script> <style> h5 { margin-bottom: 0; padding-bottom: 0; } pre { background-color: ghostwhite;