-
-
Notifications
You must be signed in to change notification settings - Fork 933
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
Support orjson for JSON #304
Comments
That'd be grand. Better suited as a third party package, than built into core. (Possible we might drop UJSON out of the core package at some point too) Aside: We might also want to link to example snippets of code from the "Third party packages" section, rather than forcing contributors to create a fully fledged python package? |
I stumbled over this idea as well, and realised that I could just make a simple function: async def json_loads(request: Request) -> dict:
return orjson.loads(await request.body()) Using function: await json_loads(request) |
And how about passing the parsing function as an optional argument? |
I'd like to add https://github.com/ijl/orjson as a JSON serializer and deserializer. The motivation is performance.
It's difficult to install, though, because it's a Rust extension. It assumes either a Rust nightly compiler or a prebuilt wheel. So if included, it's probably not appropriate for a
[full]
install, which requires a C compiler, but some other target.It can also either replace
json.loads
or only be a renderer.To validate the performance motivation, take the patch at the end, and run:
WIth
wrk -d 30 http://0.0.0.0:8000/
, I see:Patch to test:
Thoughts?
The text was updated successfully, but these errors were encountered: