Created
February 2, 2021 18:23
-
-
Save dg/833d028557c5ee1d8b7a1f57b23981e1 to your computer and use it in GitHub Desktop.
Benchmark Tracy Dumper vs Symfony VarDumper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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