Skip to content
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

Faster libraries: orjson and uuid_utils #661

Open
ff137 opened this issue Feb 13, 2025 · 4 comments
Open

Faster libraries: orjson and uuid_utils #661

ff137 opened this issue Feb 13, 2025 · 4 comments
Labels
proposal Enhancement idea or proposal

Comments

@ff137
Copy link
Contributor

ff137 commented Feb 13, 2025

Proposed change

Good day

I'd like to propose additional optional dependencies for faster performance.

orjson is widely adopted and outperforms the built-in json library - https://github.com/ijl/orjson
.loads being 2x faster and .dumps 10x faster

uuid-utils is 10x faster than uuid - https://github.com/aminalaee/uuid-utils
^ My only reason for proposing this is after seeing it used in Subscription.next_msg(): task_name = str(uuid4()) (only place it's used)

I understand if you don't want these to replace the built-in default libraries, so I wonder if optional dependencies are the best way to add it.

Either way, I think these will make significant performance improvements to the library (relatively speaking, it's already very fast)

Let me know what you think

Use case

Faster performance

Contribution

I can contribute this feature - just need to know the desired implementation (optional dependency vs built-in), and if they are separate extras or can be included together (they both use rust bindings).

@ff137 ff137 added the proposal Enhancement idea or proposal label Feb 13, 2025
@wallyqs
Copy link
Member

wallyqs commented Feb 13, 2025

yes as optional dependencies I think sounds reasonable, we do something similar with an optional dependency for parsing headers too

@ff137
Copy link
Contributor Author

ff137 commented Feb 13, 2025

I've taken a swing at adding orjson support. Let me know what you think

@wallyqs
Copy link
Member

wallyqs commented Feb 13, 2025

as extra_requires like these should work:

        "aiohttp": ["aiohttp"],
        "fast_parse": ["fast-mail-parser"],

@ff137
Copy link
Contributor Author

ff137 commented Feb 13, 2025

Ah yes, forgot to add to setup.py

Just added. Please check out the PR and let me know best path to resolve errors: #662

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal Enhancement idea or proposal
Projects
None yet
Development

No branches or pull requests

2 participants