-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
consider using Routes for routing #1318
Comments
Do you have any benchmarks? What benefits would you see for adopting this over the existing solution? I'm personally in favor of keeping external dependencies as slim as possible. While the sanic router could use some work, and is generally rather performant, I would not be in favor of adding a third party package. I know of a few other alternative ideas floating around. |
@petri I wrote a small benchmark suite for testing different routing systems in Python. Here's the repository. I don't believe Routes is a good choice and, if a mature routing system is to be considered, then I would really consider Falcon's. |
@vltr nice work! Thanks for sharing. |
I agree with @vltr but I will claim bias as I migrated to Sanic from Falcon. |
@sjsadowski yeah, well, I'm glad this benchmark is just for the router 😄 Being "pure Python", the Falcon router really does a good job (Sanic does too, but with a lot of regex and high complexity searches, yet still error prone in some situations). |
Since we are on the topic ... I'm curious to hear how people would react to using C extensions or cython in situations like this one to gain some more performance. |
@ahopkins not only performance may I add; the Sanic router, like I said, might be error prone in some situations exactly because of its complexity (and flexibility). I know very well that it was (made this way) with the best of intentions, but this might be a trade-off between having such flexibility on the router or have a fast and reliable router ... It's hard to choose 😅 |
I tend to prefer flexibility over speed here (blasphemy?) because aside from everything else, we're still functioning at web-speed. I think also moving to an extension - that would be compiled - starts to increase difficulty of adoption for people who may not have access or support to build extensions. |
No blasphemy at all. I believe that a compiled extension is on the table because we already depend on some ( |
I was not proposing compilation for users of Sanic, but before the release (hence whoever it is that is going to work on the development of the router). We can pre-compile and just |
Not alone in that quest! |
@ahopkins uvloop and ujson are already compiled dependencies. The decision was already made to favor speed. I say go for it. |
@sjsadowski yes, I think it's good to leave it open and start a further discussion in the community forum since our current Router (and overall Request workflow (see #1317 and related issues)) really needs some attention - either from the performance perspective to the complexity perspective, design and etc. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is incorrect, please respond with an update. Thank you for your contributions. |
Related discussion here: https://community.sanicframework.org/t/making-sanic-even-faster/298?u=ahopkins This is on my radar after ASGI. |
Closing this. The forums have plenty more information about this. |
Routes https://routes.readthedocs.io/en/latest/ is a mature router implementation that focuses on URL routing and nothing more.
The text was updated successfully, but these errors were encountered: