GithubHelp home page GithubHelp logo

c9s / php-router-benchmark Goto Github PK

View Code? Open in Web Editor NEW

This project forked from veonik/php-router-benchmark

2.0 3.0 0.0 140 KB

Benchmarks of different routing solutions (fork from tyler and include r3 routing benchmark)

License: MIT License

PHP 100.00%

php-router-benchmark's Introduction

PHP Router Benchmark

The intent here is to benchmark different PHP routing solutions. This is a micro-optimization, done purely out of dumb curiosity.

Installation

Clone the repo, run composer install, run php run-tests.php.

You can install the Pux extension to test that as well. See Pux docs for more info.

Currently

The current test creates 1000 routes, each with a randomized prefix and postfix, with 9 parameters each.

It was run with the Pux extension enabled.

An example route: /9b37eef21e/{arg1}/{arg2}/{arg3}/{arg4}/{arg5}/{arg6}/{arg7}/{arg8}/{arg9}/bda37e9f9b

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
r3 - last route (1000 routes) 998 0.0000219957 +0.0000000000 baseline
r3 - unknown route (1000 routes) 989 0.0000232766 +0.0000012809 6% slower
FastRoute - unknown route (1000 routes) 988 0.0008175699 +0.0007955742 3617% slower
FastRoute - last route (1000 routes) 988 0.0008405223 +0.0008185266 3721% slower
Symfony2 Dumped - unknown route (1000 routes) 983 0.0021163105 +0.0020943148 9521% slower
Symfony2 Dumped - last route (1000 routes) 990 0.0025903439 +0.0025683483 11677% slower
Pux PHP - unknown route (1000 routes) 981 0.0045674659 +0.0045454702 20665% slower
Pux PHP - last route (1000 routes) 992 0.0051111209 +0.0050891252 23137% slower
Symfony2 - unknown route (1000 routes) 973 0.0090566973 +0.0090347016 41075% slower
Symfony2 - last route (1000 routes) 998 0.0096361680 +0.0096141723 43709% slower
Aura v2 - unknown route (1000 routes) 980 0.3795325072 +0.3795105116 1725387% slower
Aura v2 - last route (1000 routes) 978 0.3948666711 +0.3948446754 1795101% 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 6 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 987 0.0000159752 +0.0000000000 baseline
Pux PHP - first route 984 0.0000486335 +0.0000326583 204% slower
FastRoute - first route 969 0.0000897977 +0.0000738225 462% slower
Symfony2 Dumped - first route 977 0.0001364784 +0.0001205032 754% slower
Symfony2 - first route 999 0.0006037644 +0.0005877892 3679% slower
Aura v2 - first route 979 0.0009121995 +0.0008962242 5610% slower

php-router-benchmark's People

Contributors

c9s avatar realityking avatar stof avatar tyler-sommer avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.