2

I'm planning my first project with the actual version of Symfony 3.0. So this won't be my last question :)

What I wonder most about at the moment are routes. In the symfony book the default way to realize routes is by using annotations in the controller classes. Does this mean every single time someone hits my URL all the classes are parsed to find the most matching route? Wouldn't be this a real performance issue? Or is there a built-in cache?

2 Answers 2

2

I suggest to take a look at the talk

Symfony Routing Under the hood - David Buchmann

That do a great overview to the Symfony Routing component.

Routing is compiled in php code, that is cached in prod environment

Main point of optimization is about:

  • Compile routes to PHP
  • Dump cached matcher, single class
  • Group similar routes
  • Prefer strpos, use regex only when needed
  • Possesive quantifiers in regex

Hope this help

Sign up to request clarification or add additional context in comments.

1 Comment

one slide says: dev env checks for file changes; prod env only on cache:clear. Funny that it's not that explicit in the symfony book.
2

Annotations are compiled to PHP code an cached in this way (check documentation), but url is matched to rules in the beginning of every request.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.