This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
Nicolas Grekas d7658d24f3 bug #26169 [Routing] Handle very large set of dynamic routes (nicolas-grekas)
This PR was merged into the 4.1-dev branch.

Discussion
----------

[Routing] Handle very large set of dynamic routes

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Follow up of #26059; allows handling very long lists of dynamic routes.
Allows running https://github.com/tyler-sommer/php-router-benchmark seamlessly.

BTW, here are the result of running this benchmark:

R3 extension is not loaded. Skipping initialization for "Worst-case matching" test using R3.
R3 extension is not loaded. Skipping initialization for "First route matching" test using R3.
## Worst-case matching
This benchmark matches the last route and unknown route. It generates a randomly prefixed and suffixed route in an attempt to thwart any optimization. 1,000 routes each with 9 arguments.

This benchmark consists of 10 tests. Each test is executed 1,000 times, the results pruned, and then averaged. Values that fall outside of 3 standard deviations of the mean are discarded.

Test Name | Results | Time | + Interval | Change
--------- | ------- | ---- | ---------- | ------
Symfony4 - unknown route (1000 routes) | 995 | 0.0000085699 | +0.0000000000 | baseline
Symfony4 - last route (1000 routes) | 999 | 0.0000086754 | +0.0000001055 | 1% slower
FastRoute - unknown route (1000 routes) | 980 | 0.0000305154 | +0.0000219455 | 256% slower
FastRoute - last route (1000 routes) | 999 | 0.0000529922 | +0.0000444223 | 518% slower
Pux PHP - unknown route (1000 routes) | 972 | 0.0003162730 | +0.0003077032 | 3591% slower
Pux PHP - last route (1000 routes) | 999 | 0.0004376847 | +0.0004291148 | 5007% slower
Aura v2 - unknown route (1000 routes) | 976 | 0.0138277517 | +0.0138191818 | 161253% slower
Aura v2 - last route (1000 routes) | 989 | 0.0138914190 | +0.0138828491 | 161996% slower

## First route matching
This benchmark tests how quickly each router can match the first route. 1,000 routes each with 9 arguments.

This benchmark consists of 5 tests. Each test is executed 1,000 times, the results pruned, and then averaged. Values that fall outside of 3 standard deviations of the mean are discarded.

Test Name | Results | Time | + Interval | Change
--------- | ------- | ---- | ---------- | ------
FastRoute - first route | 999 | 0.0000016928 | +0.0000000000 | baseline
Pux PHP - first route | 999 | 0.0000017381 | +0.0000000453 | 3% slower
Symfony4 - first route | 997 | 0.0000029818 | +0.0000012890 | 76% slower
Aura v2 - first route | 977 | 0.0000376436 | +0.0000359508 | 2124% slower

Commits
-------

ee8b201 [Routing] Handle very large set of dynamic routes
2018-02-14 12:55:41 +01:00
.composer Drop hirak/prestissimo 2016-05-12 07:44:15 -05:00
.github fix the Composer API being used 2018-01-18 12:52:12 +01:00
src/Symfony [Routing] Handle very large set of dynamic routes 2018-02-13 17:19:02 +01:00
.editorconfig Add EditorConfig File 2012-06-16 14:08:15 +02:00
.gitignore Add appveyor.yml for C.I. on Windows 2015-08-25 23:41:37 +02:00
.php_cs.dist Merge branch '2.8' into 3.3 2018-01-03 18:13:53 +01:00
.travis.yml fix merge 2018-02-09 16:04:34 +01:00
appveyor.yml Merge branch '3.4' into 4.0 2018-01-16 19:04:12 +01:00
CHANGELOG-4.0.md updated CHANGELOG for 4.0.4 2018-01-29 14:26:56 +01:00
composer.json Merge branch '3.3' into 3.4 2018-01-15 11:51:37 +01:00
CONTRIBUTING.md Mention the community review guide 2016-12-18 22:02:35 +01:00
CONTRIBUTORS.md update CONTRIBUTORS for 2.7.41 2018-01-29 11:08:31 +01:00
LICENSE fixed years in copyright 2018-01-03 08:23:28 +01:00
link Update Repository Symlink Helper 2018-02-11 12:15:02 +01:00
phpunit Force phpunit-bridge update (bis) 2017-11-22 10:25:38 +01:00
phpunit.xml.dist Merge branch '3.2' 2017-04-12 07:14:56 -07:00
README.md Prefer composer install instead for using Symfony Installer 2018-01-10 18:56:50 +01:00
UPGRADE-4.0.md Fixed 'RouterInteface' typo 2017-12-20 16:01:44 +01:00
UPGRADE-4.1.md [WebProfilerBundle] Imply forward request by a new X-Previous-Debug-Token header 2018-02-12 18:43:33 +01:00
UPGRADE-5.0.md [WebProfilerBundle] Imply forward request by a new X-Previous-Debug-Token header 2018-02-12 18:43:33 +01:00

Symfony is a PHP framework for web applications and a set of reusable PHP components. Symfony is used by thousands of web applications (including BlaBlaCar.com and Spotify.com) and most of the popular PHP projects (including Drupal and Magento).

Installation

Documentation

Community

Contributing

Symfony is an Open Source, community-driven project with thousands of contributors. Join them contributing code or contributing documentation.

Security Issues

If you discover a security vulnerability within Symfony, please follow our disclosure procedure.

About Us

Symfony development is sponsored by SensioLabs, led by the Symfony Core Team and supported by Symfony contributors.