Skip to content

use orjson instead of json#175

Merged
mdonoughe merged 4 commits intogurumitts:devfrom
jonoberheide:dev
Dec 26, 2024
Merged

use orjson instead of json#175
mdonoughe merged 4 commits intogurumitts:devfrom
jonoberheide:dev

Conversation

@jonoberheide
Copy link
Copy Markdown
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.

jonoberheide and others added 2 commits November 13, 2024 20:10
Comment thread src/pylutron_caseta/leap.py Outdated
Comment thread src/pylutron_caseta/pairing.py Outdated
@bdraco
Copy link
Copy Markdown
Contributor

bdraco commented Nov 14, 2024

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

@bdraco
Copy link
Copy Markdown
Contributor

bdraco commented Nov 14, 2024

Tested with an RA2 select system 👍

Comment thread src/pylutron_caseta/leap.py Outdated
Comment thread src/pylutron_caseta/pairing.py Outdated
Comment thread tests/test_leap.py Outdated
@jonoberheide
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

swails commented Nov 24, 2024

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

@mdonoughe mdonoughe merged commit 2f46086 into gurumitts:dev Dec 26, 2024
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