I’m working on an event framework to facilitate programming in response to timers and I/O. A decision I need to make fairly early is whether to use stl collections or custom code my own collections. I have a start on timer handling and have implemented it both ways. I thought it might be useful to share that with the community for feedback on this. I’m looking at both code size and RAM footprint. Initially a small test shows that choosing stl uses more. (974 bytes code as reported at compile and 58 bytes more RAM reported using the MemoryFree library.)
stl pros and cons - bigger code and RAM footprint, requirement to install an additional library, easier and more flexible programming.
custom container - smaller code and RAM footprint, more programming effort.
Sketch programming requirements should be similar for either choice. My intent is to make this into a library to share with others so ease of use is important.
The code itself is too big to include inline so I have included as attachments.
In addition to the specific question regarding memory footprint, I appreciate other comments on the idea and sketches. If I go with custom code I plan to make other significant changes because I don’t really like the first cut. Namely I would probably templateize the various types of event classes, but I am open to other patterns that might be applicable.
ef_memcheck.ino (6.32 KB)
STL_ev_memcheck.ino (5.38 KB)