notrab / dumbo

A lightweight, friendly PHP framework for HTTP.
MIT License
158 stars 16 forks source link

Perf. improvement on Router.php #60

Closed yoh closed 1 month ago

yoh commented 1 month ago

Related to #59 I propose to call Router::buildDispatcher() only one time when the app is run (Dumbo::run()).

The caching feature may be discuss in a second time. It impose several choices (handlers cannot be closures, etc.) + Dumbo constructor options to configure file/etc. or others implementations that I can't take. Have you an idea about the wished implementation of this ?

notrab commented 1 month ago

@yoh I just want to confirm that this doesn't impact any grouped routes? There was an issue early on when there was no dispatcher at all, or when it was ran once then routes weren't found.

I tried it locally, and seems fine though 🤩