veonik / php-router-benchmark

Benchmarks of different routing solutions
MIT License
50 stars 11 forks source link

can not install "pux" by using composer. #11

Open lloydzhou opened 8 years ago

lloydzhou commented 8 years ago

Your requirements could not be resolved to an installable set of packages.

Problem 1

c9s commented 8 years ago

Add "phpsgi/phpsgi": "@dev", to your composer.json

c9s commented 8 years ago

PR opened in #12

lloydzhou commented 8 years ago

@c9s Thanks!!!

lloydzhou commented 8 years ago

I have write one Router class, to resolve the URL to callback handler. I have test it and get the belong result (my router is fast in this benchmark, i will test it with the C extension):

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 12 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
Router - unknown route (1000 routes) 989 0.0000177037 +0.0000000000 baseline
Router - last route (1000 routes) 984 0.0000203938 +0.0000026900 15% slower
FastRoute - unknown route (1000 routes) 989 0.0003165348 +0.0002988311 1688% slower
FastRoute - last route (1000 routes) 998 0.0003339021 +0.0003161984 1786% slower
Symfony2 Dumped - unknown route (1000 routes) 993 0.0008910154 +0.0008733117 4933% slower
Symfony2 Dumped - last route (1000 routes) 998 0.0009655998 +0.0009478961 5354% slower
Pux PHP - last route (1000 routes) 996 0.0027640014 +0.0027462977 15513% slower
Pux PHP - unknown route (1000 routes) 994 0.0028454037 +0.0028276999 15972% slower
Symfony2 - unknown route (1000 routes) 994 0.0045681511 +0.0045504473 25703% slower
Symfony2 - last route (1000 routes) 993 0.0054728221 +0.0054551184 30813% slower
Aura v2 - last route (1000 routes) 998 0.1519357850 +0.1519180813 858114% slower
Aura v2 - unknown route (1000 routes) 992 0.1552685980 +0.1552508943 876940% 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 7 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
Router - unkown route 994 0.0000180977 +0.0000000000 baseline
Pux PHP - first route 996 0.0000189904 +0.0000008927 5% slower
Router - first route 994 0.0000209206 +0.0000028229 16% slower
FastRoute - first route 999 0.0000349172 +0.0000168195 93% slower
Symfony2 Dumped - first route 992 0.0000496692 +0.0000315714 174% slower
Symfony2 - first route 992 0.0002054262 +0.0001873285 1035% slower
Aura v2 - first route 998 0.0003609354 +0.0003428376 1894% slower
lloydzhou commented 8 years ago

test with php-r3 and pux-ext

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 14 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) 997 0.0000078341 +0.0000000000 baseline
r3 - last route (1000 routes) 995 0.0000105369 +0.0000027029 35% slower
Router - unknown route (1000 routes) 992 0.0000188012 +0.0000109671 140% slower
Router - last route (1000 routes) 992 0.0000199661 +0.0000121321 155% slower
FastRoute - unknown route (1000 routes) 989 0.0003324273 +0.0003245933 4143% slower
FastRoute - last route (1000 routes) 998 0.0003505095 +0.0003426754 4374% slower
Symfony2 Dumped - unknown route (1000 routes) 998 0.0008737620 +0.0008659280 11053% slower
Pux ext - unknown route (1000 routes) 998 0.0009388064 +0.0009309723 11884% slower
Pux ext - last route (1000 routes) 998 0.0010594999 +0.0010516658 13424% slower
Symfony2 Dumped - last route (1000 routes) 998 0.0011358077 +0.0011279736 14398% slower
Symfony2 - last route (1000 routes) 995 0.0048178922 +0.0048100581 61399% slower
Symfony2 - unknown route (1000 routes) 994 0.0050545266 +0.0050466926 64420% slower
Aura v2 - last route (1000 routes) 986 0.1500148822 +0.1500070481 1914802% slower
Aura v2 - unknown route (1000 routes) 996 0.1623154067 +0.1623075726 2071815% 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.0000078204 +0.0000000000 baseline
Pux ext - first route 999 0.0000160752 +0.0000082548 106% slower
Router - unkown route 994 0.0000186509 +0.0000108304 138% slower
Router - first route 992 0.0000213913 +0.0000135709 174% slower
FastRoute - first route 988 0.0000356728 +0.0000278523 356% slower
Symfony2 Dumped - first route 991 0.0000493382 +0.0000415178 531% slower
Symfony2 - first route 999 0.0001964001 +0.0001885797 2411% slower
Aura v2 - first route 998 0.0003710765 +0.0003632561 4645% slower