-
Notifications
You must be signed in to change notification settings - Fork 361
Description
The logger output in reactive_ble_mobile_platform.dart, is evaluated for each received message. Especially the interpolation of the characteristic is quite resource hungry. We are receiving a lot of characteristics data and this string interpolation takes up about 10-15% of CPU usage for our data handling.
flutter_reactive_ble/packages/reactive_ble_mobile/lib/src/reactive_ble_mobile_platform.dart
Lines 59 to 61 in 9aa9957
| _logger?.log( | |
| 'Received $CharacteristicValue(characteristic: ${update.characteristic}, result: ${update.runtimeType})', | |
| ); |
Unfortunately the logger is always initialized via the following code and I don't see any way to disable it.
flutter_reactive_ble/packages/flutter_reactive_ble/lib/src/reactive_ble.dart
Lines 100 to 105 in 9aa9957
| Future<void> initialize() async { | |
| if (_initialization == null) { | |
| _debugLogger = DebugLogger( | |
| 'REACTIVE_BLE', | |
| print, | |
| ); |
Can this be refactored, that the logger does not have to be initialized and can be set to null if not used? AFAIK then the interpolation would not be executed, resulting in less CPU usage.