Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
See #4176 (comment) Co-Authored-By: Simon André <[email protected]> ``` # Old Benchmark 1: php bench.php Time (mean ± σ): 1.204 s ± 0.012 s [User: 1.185 s, System: 0.011 s] Range (min … max): 1.191 s … 1.225 s 10 runs # New Benchmark 1: php bench.php Time (mean ± σ): 368.3 ms ± 4.8 ms [User: 354.2 ms, System: 10.1 ms] Range (min … max): 362.9 ms … 375.6 ms 10 runs ``` Using bench.php: ``` <?php require_once __DIR__.'/vendor/autoload.php'; $string = str_repeat("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut a tincidunt turpis. \\App\\Entity\\Product \World \065 App\#{var} \'quoted\' Donec pharetra enim quis erat pharetra, dignissim molestie erat laoreet. Vivamus auctor purus sed lorem vestibulum rhoncus.", 10); $loader = new Twig\Loader\ArrayLoader([ 'index.twig' => <<<EOF {{ "$string" }} EOF , ]); $twig = new Twig\Environment($loader); for ($i = 0; $i < 10000; $i++) { $twig->tokenize(new Twig\Source($twig->getLoader()->getSourceContext('index.twig')->getCode(), 'index.twig')); } ```
- Loading branch information