-
-
Notifications
You must be signed in to change notification settings - Fork 252
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
Use Actix as base #35
Conversation
@JackThomson2 , is your PR ready for review or are you still working on it?? |
@sansyrox Yes it's ready. Key new features are: Much faster performance, ability to set custom response headers and passing the post body to post functions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @JackThomson2 👋
Thank you for the amazing work 🚀 .
I have some questions can you please answer them before we move ahead?
Thanks.
// pyO3 module | ||
use actix_web::*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we switch this to individual imports instead of importing everything?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can do, its actix convention in the docs to import all
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JackThomson2 , please change it to import specific items instead of an import all and then we can merge this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, approved it by mistake 😅
self.add_route("POST", endpoint, handler) | ||
|
||
return inner | ||
|
||
def put(self, endpoint): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JackThomson2 , I think if we copy your POST implementation to PUT method, it should also work well imo. What do you think?
Hey @JackThomson2 👋 |
Hi, sorry got pretty side-tracked this weekend, will need a bit of a rebase before we can merge, I'll see if I have time tomorrow |
@JackThomson2 , yep yep no worries. I just got really excited after seeing the response time reduce to 1/3rd of itself 😅 |
Yes it's a huge upgrade, using actix opens a lot more opportunities for file serving or websockets etc. I'm going to look at implementing https://github.com/davidhewitt/pythonize which would allow us to serialise the json from the rust side rather than python side. |
@sansyrox Want to have a look now? Please test this on your machine before merging :) |
@JackThomson2 , this looks great ✨ . I will test it on my machine today evening and will rebase merge it then. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works well. LGTM 🚀
@JackThomson2 , this was an amazing PR 🔥 |
@JackThomson2 , I also tried using this but since the incoming response has no fixed structure(read nested json) , I thought it wouldn't be possible to extract the object in a map. It will be amazing it we could find a way to bypass it. |
Actix is a very fast framework and is at the top of the TechEmpowered benchmarks
In my testing it is considerably faster than the hyper backend:
Hyper:
Actix: