Skip to content

Instantly share code, notes, and snippets.

@dg
Created Feb 2, 2021
Embed
What would you like to do?
Benchmark Tracy Dumper vs Symfony VarDumper
<?php
declare(strict_types=1);
require __DIR__ . '/vendor/autoload.php';
// create container
$configurator = new Nette\Configurator;
$configurator->setTempDirectory(__DIR__ . '/temp');
$configurator->addConfig([
'routing' => ['debugger' => false],
'security' => ['debugger' => false],
'di' => ['debugger' => false],
'session' => ['debugger' => false],
]);
$container = $configurator->createContainer();
$router = $container->getByType(Nette\Application\IRouter::class);
$router->withDomain('blog.%domain%')
->addRoute('[category/<category>/][<?page page|offset>/<page=1 \d+>]', 'Blog:Front:Homepage:default')
->addRoute('archives', 'Blog:Front:Archive:default')
->addRoute('sitemap.xml', 'Blog:Front:Export:sitemap')
->addRoute('feed/<action rss|comments>[2][/<id>]', 'Blog:Front:Export:') // rss2
->addRoute('admin/<presenter=Admin>/<action=default>', ['module' => 'Blog:Admin'])
->addRoute('<slug>', 'Blog:Front:Article:default');
$router->addRoute('//builtwith.%domain%/<action>', 'BuiltWith:BuiltWith:default');
$router->warmupCache();
$obj = $container->getByType(Nette\Application\Application::class);
// symfony
use Symfony\Component\VarDumper\Cloner\VarCloner;
use Symfony\Component\VarDumper\Dumper\CliDumper;
use Symfony\Component\VarDumper\Dumper\HtmlDumper;
$cloner = new VarCloner;
$dumper = new HtmlDumper;
$dumper->dump($cloner->cloneVar($obj), true);
// tracy dump
use Tracy\Dumper;
Dumper::toHtml($obj, [Dumper::DEPTH => 50]);
{
"require": {
"nette/nette": "^3.0",
"nette/application": "~3.0.0",
"symfony/var-dumper": "^5.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment