-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Annotations Router to use patterns as prefix #14259
Merged
niden
merged 4 commits into
phalcon:4.0.x
from
zsilbi:annotations-router-pattern-prefix
Sep 10, 2019
Merged
Annotations Router to use patterns as prefix #14259
niden
merged 4 commits into
phalcon:4.0.x
from
zsilbi:annotations-router-pattern-prefix
Sep 10, 2019
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If you rebase probably your mysql will build again. |
zsilbi
force-pushed
the
annotations-router-pattern-prefix
branch
from
August 14, 2019 10:37
e3ce6cd
to
1b793a6
Compare
zsilbi
commented
Aug 14, 2019
Codecov Report
@@ Coverage Diff @@
## 4.0.x #14259 +/- ##
=======================================
Coverage 67.78% 67.78%
=======================================
Files 478 478
Lines 112862 112921 +59
=======================================
+ Hits 76506 76546 +40
- Misses 36356 36375 +19 |
zsilbi
force-pushed
the
annotations-router-pattern-prefix
branch
from
September 10, 2019 13:36
fa8ab72
to
46556c1
Compare
zsilbi
force-pushed
the
annotations-router-pattern-prefix
branch
from
September 10, 2019 13:44
46556c1
to
5faddd1
Compare
zsilbi
changed the title
[WIP] Annotations Router to use patterns as prefix
Annotations Router to use patterns as prefix
Sep 10, 2019
sergeyklay
approved these changes
Sep 10, 2019
niden
approved these changes
Sep 10, 2019
niden
added
4.0
documentation
Documentation required
enhancement
Enhancement to the framework
labels
Sep 10, 2019
Thank you @zsilbi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello!
In raising this pull request, I confirm the following:
To use
Mvc\Router\Annotations
, you have to add the resources that you want it to parse.You can assign a prefix for every resource for faster handling.
Adding controllers with distinct prefixes will work great, even in a huge a project.
If you don't use prefixes, it will basicly need to check and parse every resource that you added. It will be a bit slow but will work good enough for small projects.
However, if you have a lot of controllers with prefixes that have parameters or placeholders in the beginning, you won't be able to use them.
For example if you have 75 controllers with prefixes like this:
In this case, only the
/clients
prefix can be used for all the 75 controllers.In my test runs, I used a total of 150 resources, 75 with the same prefix and the average route handling time was over 50ms. Without using any prefixes, it was around 90ms.
My idea would be to compile the prefixes as standard route patterns, so you could pass any type of pattern as a prefix along with your resource to the
Router
.I repeated the same tests using this code, and my average route handling time was around 3ms which I find somewhat acceptable.
Thanks,
zsilbi