Skip to content

Instantly share code, notes, and snippets.

@Ronmi
Last active October 20, 2015 08:20
Show Gist options
  • Select an option

  • Save Ronmi/d7ac120207f2c67bb579 to your computer and use it in GitHub Desktop.

Select an option

Save Ronmi/d7ac120207f2c67bb579 to your computer and use it in GitHub Desktop.

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 16 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
r3 - unknown route (1000 routes) 995 0.0000081977 +0.0000000000 baseline
r3 - last route (1000 routes) 997 0.0000102492 +0.0000020514 25% slower
Fruit RouteKit Compiled - last route (1000 routes) 999 0.0000529893 +0.0000447916 546% slower
Fruit RouteKit Compiled - unknown route (1000 routes) 986 0.0001082611 +0.0001000634 1221% slower
Fruit RouteKit - unknown route (1000 routes) 972 0.0002214695 +0.0002132718 2602% slower
Fruit RouteKit - last route (1000 routes) 996 0.0002292081 +0.0002210104 2696% slower
FastRoute - unknown route (1000 routes) 988 0.0002313954 +0.0002231976 2723% slower
FastRoute - last route (1000 routes) 999 0.0002411273 +0.0002329296 2841% slower
Symfony2 Dumped - unknown route (1000 routes) 991 0.0004726722 +0.0004644744 5666% slower
Pux ext - unknown route (1000 routes) 991 0.0005102117 +0.0005020139 6124% slower
Symfony2 Dumped - last route (1000 routes) 998 0.0005184916 +0.0005102939 6225% slower
Pux ext - last route (1000 routes) 998 0.0005385162 +0.0005303184 6469% slower
Symfony2 - unknown route (1000 routes) 994 0.0026836738 +0.0026754761 32637% slower
Symfony2 - last route (1000 routes) 995 0.0027508252 +0.0027426274 33456% slower
Aura v2 - last route (1000 routes) 994 0.1000357612 +0.1000275635 1220184% slower
Aura v2 - unknown route (1000 routes) 988 0.1002764941 +0.1002682963 1223120% 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 8 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
php-r3 - first route 997 0.0000080811 +0.0000000000 baseline
Pux ext - first route 994 0.0000153756 +0.0000072945 90% slower
Fruit RouteKit Compiled - first route 995 0.0000214689 +0.0000133878 166% slower
FastRoute - first route 998 0.0000264613 +0.0000183802 227% slower
Symfony2 Dumped - first route 995 0.0000364828 +0.0000284017 351% slower
Fruit RouteKit - first route 991 0.0000517951 +0.0000437140 541% slower
Symfony2 - first route 999 0.0001355432 +0.0001274621 1577% slower
Aura v2 - first route 995 0.0002287179 +0.0002206368 2730% slower
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment