You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf: shrink DigitalMultiWrite8/16 nibble LUTs (592/1184 B on AVR, ~1.3/2.6 KB on 32-bit) #5314
DigitalMultiWrite8 / DigitalMultiWrite16 (src/fl/system/pins.h) store their nibble LUTs as PinList { int pins[4]; u8 count; } arrays: 64 / 128 entries. Object size:
AVR (int = 2 B)
32-bit (padded to 20 B/entry)
DigitalMultiWrite8
592 B
~1312 B
DigitalMultiWrite16
1184 B
~2624 B
#5313 removed these objects from the stack of the one-shot digitalMultiWrite8/16 free functions. Long-lived instances still pay this cost, for example BitbangChannelDriver::mMultiWriter (src/platforms/shared/bitbang/bitbang_channel_driver.h), and so does any user code that keeps a writer as a member or a local.
Proposed solution
Shrink the representation and keep the writeByte() hot path's digitalWrite sequence. Options:
Store LUT entries as 2-bit indices into mPins (a u8 per nibble value for the set mask plus the count), so each group needs 16 B of LUT plus 4 pins.
Drop the LUT and test bits directly, as the free functions now do. This needs a timing check with the AutoResearch writeByte benchmark (examples/AutoResearch/AutoResearchRemoteBenchmarkMethods.cpp) on a bitbang target, because the bitbang clockless timing depends on it.
Acceptance: object size and writeByte timing are measured before and after on AVR and on an ESP32 or RP2040 bitbang target, and the pin states and write order are unchanged (the tests in tests/fl/system/pin.cpp already compare the classes against the free functions).
Activity
perf(pins): drop DigitalMultiWrite8/16 nibble LUTs (592/1184 B -> 17/…