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
feat: speed up incoming packet reader #1314
Conversation
199fbfc
to
1c7a4d3
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1314 +/- ##
=======================================
Coverage 99.77% 99.77%
=======================================
Files 29 29
Lines 3053 3079 +26
Branches 513 516 +3
=======================================
+ Hits 3046 3072 +26
Misses 5 5
Partials 2 2 ☔ View full report in Codecov by Sentry. |
The problem is its a 25% slow down for the pure python case |
I think this still has potential if we use an lru since 99% of the data is the same Type, class can be one key |
Maybe similar to how we do it in aioesphomeapi. Use a cache wrapper that cython can convert from memory view to bytes and than py int to uint Should work because view is really bytes on pure python anyways. But is it faster...? |
At least in pure python we probably reduce gc cycles by 99% |
Maybe it's better to keep the specialized unpacks but use the views instead. |
This is ~14% speed up
before: Parsing 100000 incoming messages took 2.3616396670695394 seconds
after: Parsing 100000 incoming messages took 2.012439667014405 seconds