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

use orjson instead of json #175

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open

Conversation

jonoberheide
Copy link
Contributor

Use orjson instead of json like home assistant does. pylutron-caseta spends a lot of time munging json and orjson is fast at that. The main compatibility difference between json and orjson is that dumps() returns bytes.

src/pylutron_caseta/leap.py Outdated Show resolved Hide resolved
@bdraco
Copy link
Contributor

bdraco commented Nov 14, 2024

I think this is a good change. Some minor nits above.

@bdraco
Copy link
Contributor

bdraco commented Nov 14, 2024

Tested with an RA2 select system 👍

src/pylutron_caseta/leap.py Outdated Show resolved Hide resolved
tests/test_leap.py Outdated Show resolved Hide resolved
@jonoberheide
Copy link
Contributor Author

Tested with an RA2 select system 👍

Your Lutron lights are approaching the speed of light now! 🏎💨

I should note I'm testing on QSX.

Copy link
Collaborator

@mdonoughe mdonoughe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if this is going to make a noticeable difference because the CPU running pylutron_caseta should be much faster than the CPU in the bridge, or at least that's the case for Caseta.

@bdraco
Copy link
Contributor

bdraco commented Nov 24, 2024

Might make a difference for some single board systems, then again the pure Python JSON implementation should be an order of magnitude slower or worse if the hub has implemented it in native code

@swails
Copy link
Contributor

swails commented Nov 24, 2024

The hub uses a compiled language (golang). It'll be pretty fast, even on a much slower CPU.

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

Successfully merging this pull request may close these issues.

4 participants