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

feat: speed up to processing bluez passive data #221

Merged
merged 18 commits into from
Aug 9, 2023

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Aug 9, 2023

Edit: after reviewing test data from multiple systems, this is avg of ~43% speed up

The previous design would create a response message and never send it if no reply was expected. Since the RSSI updates were all generating reply messages and throwing them away it was a significant CPU time use. By not generating the message we speed up getting data from the stream, and since everything has to wait for the data stream to get notifications / new GATT data it speeds up everything bluetooth for local adapters

@codecov
Copy link

codecov bot commented Aug 9, 2023

Codecov Report

Patch coverage: 85.18% and project coverage change: +0.03% 🎉

Comparison is base (6c2412f) 82.67% compared to head (fe1356d) 82.71%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #221      +/-   ##
==========================================
+ Coverage   82.67%   82.71%   +0.03%     
==========================================
  Files          27       27              
  Lines        3221     3240      +19     
  Branches      668      671       +3     
==========================================
+ Hits         2663     2680      +17     
  Misses        343      343              
- Partials      215      217       +2     
Files Changed Coverage Δ
src/dbus_fast/__version__.py 0.00% <0.00%> (ø)
src/dbus_fast/message_bus.py 72.64% <85.71%> (+0.01%) ⬆️
src/dbus_fast/message.py 95.74% <100.00%> (+0.18%) ⬆️
src/dbus_fast/service.py 88.65% <100.00%> (ø)

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bdraco bdraco force-pushed the bluetooth_passive_speed_up branch from d542f25 to 0f1f22d Compare August 9, 2023 09:17
Comment on lines +926 to +927
if not _expects_reply(msg):
return
Copy link
Member Author

Choose a reason for hiding this comment

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

The default was to always call send_reply when a reply wasn't expected it would just be thrown away. All that work for 6500 DeviceFound messages per minute and they are just discarded 🙈

@bdraco bdraco changed the title feat: small speed up to processing bluez passive data feat: speed up to processing bluez passive data Aug 9, 2023
@bdraco bdraco marked this pull request as ready for review August 9, 2023 10:44
@bdraco bdraco merged commit 8e7432d into main Aug 9, 2023
@bdraco bdraco deleted the bluetooth_passive_speed_up branch August 9, 2023 10:44
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.

1 participant