Skip to content

hbgl/php-routing-bench

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP routing library benchmarks

This repo contains benchmarks for two PHP routing libraries:

Symfony Routing in dynamic mode sequentially matches each route pattern against a URI. In compiled mode it matches static routes via dictionary lookup and dynamic routes with one giant pre-compiled regex.

FastRoute in group count mode matches batches of 10 to 30 route patterns against a URI. In mark mode it basically works like Symfony's compiled mode.

Running the bechmarks

composer run bench

This runs 10 iterations of the benchmarks after a warmup. The URLs are tested against around 300 routes which I exported from the open source application akaunting. I believe that the set of routes is representative for an medium sized application.

The following benchmarks are performed:

  • URL that matches one of the first routes (with and without parameter)
  • URL that matches a route in the middle (with and without parameter)
  • URL that matches one of the last routes (with and without parameter)
  • URL that does not match any route

Testing from the browser

The individual benchmarks can be run from the browser by serving public/index.php.

cd public
php -S localhost:8000

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages