cordova-plugin-bluetoothle icon indicating copy to clipboard operation
cordova-plugin-bluetoothle copied to clipboard

performance questions

Open sdetweil opened this issue 4 years ago • 5 comments

My App scans then needs to read characteristics from each detected device with my UUID. for 6 devices (started overlapping) this takes 6.5 seconds.. seems a lot of that time is in discover, which appears to be required for each device after connect.

is there any capability to reuse the received discover info to avoid the performance impact of this step? my devices will not change characteristics from the last read. or any other suggestion I will post ms timings when I am booted back to linux

scan

then loop thru discovered(scanned) devices (submitted in parallel)

   connect
       discover 
           read characteristic
           (maybe 2, submitted in parallel)
    disconnect
    close

this is Ionic/Vue on IOS (15.1)

sdetweil avatar Oct 11 '21 14:10 sdetweil

so, it doesn't look like discover is THE culprit (altho it adds 3/4 second to each device cycle)

charts of the processing for each device

dev6 dev5 dev4 dev3 dev2 dev1

in this whole process covered by the charts above I scan/process for some cycles... stop and repeat , for some cyles, stop and repeat again for some cycles. stop,

I haven't been able to get a good stacked bar chart, green line is total elapsed for each full process cycle.. scan/connect/discover/read/disconnect/close

scan starts a 1/2 second timer, and its reset on each new discovered device, firing after the last device , which does stopscan

then we process to get info from each device.. connect/discover/read/disconnect/close

sdetweil avatar Oct 12 '21 23:10 sdetweil

What's the advertising interval you're using on those devices? You have some high values for connect and this could help you reduce the average time your cycle takes to run.

NunoSav avatar Dec 27 '21 10:12 NunoSav

@NunoSav the devices are advertising at 100ms interval.

sdetweil avatar Dec 27 '21 14:12 sdetweil

100ms is short enough. I can't see how you can improve your cycle time any other way, if you find a way to do so please share it :)

NunoSav avatar Dec 28 '21 15:12 NunoSav

yeh, I think there is a problem in IOS locationservices with concurrent connects.

I haven't tried to build this on android.

sdetweil avatar Dec 28 '21 16:12 sdetweil