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
fl::vector<T> is already type-erased: vector_basic plus one static vector_element_ops table per non-trivial T (src/fl/stl/basic_vector.h:21,312). Every table stores every operation, though, so all of them are emitted for each non-trivial T even when that T never uses them.
Measured on master (flash):
esp32dev Blink
esp32s3 SPI
teensy41 Blink
Shared vector_basic
1,084
1,362
496
Per-type ops-table functions
1,570
969
710
Per-type vector<T> wrappers
1,062
883
288
The esp32dev ops-table cost by operation is swap 567, destroy/destroy_n 377, uninitialized_move_n 224, copy 151, move 132, default 119. The largest types are ChannelEngineRMTImpl::PendingChannel/ChannelState (~300 each), DriverInfo 271, shared_ptr<ChannelData> 259, ChannelManager::EngineEntry 222 and task::Handle 213.
Proposed fix
Remove swap_elements. The only use is the inline-buffer vector swap (basic_vector.cpp.hpp:384), which can use move_construct + destroy through a temporary.
Remove destroy in favor of destroy_n(p, 1).
Implement uninitialized_move_n once in vector_basic as a loop over move_construct.
Acceptance
About 0.8 KB less flash per ESP32 sketch, with no runtime regression in bash test vector tests or bash profile on hot vector paths.
Activity
fix(stl): keep swap_elements thunk; batch destroy_n; harden alignas l…
fix(lint): accept '// ok alignas' only in a real line comment (#4794 …
perf(stl): trim vector_element_ops (destroy, move_n); lint-ban raw al…