Beware of false economies. Are you solving a problem that you don't have?
Long answer to a short statement: (not sure if its appropriate for here.... but anyways...)
I hadn't written a line of code for 25 years. We bought a fodder growing box for my farm:
- Beef cattle
- Box is roughly a 20 foot shipping container
- Load barley seed on a flight of trays one end and harvest a sprouted flight of fodder biscuits from the other end
- End to end about 6 days. It produces 250kg of sprouted barley every 1.5 days on average
- All off-grid and with no telco / mobile coverage.
Had some time away from work and family seculuded at my farm; observed that the box we bought was hopeless on environment control - was just a watering timer and air con; stole my boys school arduino boards; had a play; thought I could do better with the box; too much time; invented an elaborate IoT control system architecture; printed out my original Berkely ANSI C and C pointers compsci papers for revision; went to work.
In hindsight, it was an overly ambitious project to run on an arduino. Its now some 16,000 lines of code, 900mhz radio links, satelite data feed, rpi / kivy controller, sensors and acutators everywhere, cloud data logging, grammar meta language to define protocols producing memory optimised parsers for management of terminal and configuration interactions, baisc term emulation and command line parsing for interactive control based on the generated parser / grammar ....
The heart of it still runs on an arduino mega and is an algorythmic AI. Its doing commercial work and feeding cows. And doing a good job. Furthermore its got investor interest for various applications here in Australia (with China knocking on the door),
At various stages I've spend countless hours optimising the code to give me enough working memory for the thing to operate larger rule sets. Currently down to 356 bytes of .data. Still work to do on the parser / terminal module consuming the best share of 1900 .bss and with too much calling stack. (and some malloc / frees to weed out).
So my drive for memory optimisation is a short term jail cell based on its evolution to date. (and is also a fun programming goal).
Its way short of being consumable as a product at this stage - still locked in my private brain cycle between dev and feeding cows, though you're welcome to browse here if you agree to be kind