mirror of
https://github.com/esphome/esphome.git
synced 2026-02-08 00:31:58 +00:00
ld2450_batch_read
Read all available bytes in batches via read_array() instead of byte-at-a-time read() calls. Each read() internally chains through read_byte -> read_array(1) -> check_read_timeout_ -> available(), resulting in 3 UART calls per byte. At 256000 baud with ~235 bytes per loop iteration, this was ~706 UART operations per loop call. Batching reduces this to ~12. Measured 33% reduction in loop time (2348ms -> 1577ms per 60s).
Description
Languages
C++
64.3%
Python
35.4%
C
0.2%
