You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I suggest using a possessive quantifier to improve the route matching performance (Symfony generates possessive quantifiers for its builtin requirements, but custom ones need to do that themselves, as using non-possessive quantifiers can still be a valid use case)
He's technically right, but we need to decide if we do that in this Demo app or not:
// BEFORE
@Route("/{id<\d+>}/edit",methods={"GET", "POST"}, name="admin_post_edit")
@Route("/page/{page<[1-9]\d*>}", defaults={"_format"="html"}, methods={"GET"}, name="blog_index_paginated")
// AFTER
@Route("/{id<\d++>}/edit",methods={"GET", "POST"}, name="admin_post_edit")
@Route("/page/{page<[1-9]\d*+>}", defaults={"_format"="html"}, methods={"GET"}, name="blog_index_paginated")
Some pros and cons:
(Con) This is a Demo app not a benchmark app, so clarity is preferred over speed.
(Con) The \d++ and \d*+ can confuse lots of developers who don't know regexp well
(Pro) Using these can be a good opportunity to help teach about them.
(Pro) It makes the routing slightly faster
...
The text was updated successfully, but these errors were encountered:
Let's close this as "won't fix". I still think that the potential confusion of doing this change is much bigger than the small performance improvement. Thanks for understanding.
As @stof explained in #817:
He's technically right, but we need to decide if we do that in this Demo app or not:
Some pros and cons:
\d++
and\d*+
can confuse lots of developers who don't know regexp wellThe text was updated successfully, but these errors were encountered: