DEV Community

Discussion on: Real life comparison of Symfony router and Mezon router

Collapse
 
nicolasgrekas profile image
Nicolas Grekas

Thanks for the update. You've got the wiring right, but $dumper->getCompiledRoutes() should never be called in a loop.

The way this is supposed to be used is:

  1. warm the list of routes by dumping the compiled routes once (eg using var_export() to generate a cache.php file)
  2. reuse the already dumped routes in the loop.
Collapse
 
alexdodonov profile image
alexdodonov

Mmmmmmm I have not dig so deep, but I shall change the benchmark.

reuse the already dumped routes in the loop.

Just include cache.php in my php script? or there is a method wich loads cached routes?

Collapse
 
nicolasgrekas profile image
Nicolas Grekas

you can dump cache.php doing eg:
file_put_contents('cache.php', '<?php return '.var_export($dumper->getCompiledRoutes(), true).';');

then to get the compiled routes:
$compiledRoutes = require 'cache.php';