Hi Jack,
Yes, most programing optimization is in the design and the chosen solutions to the problem you are trying to solve. That is a bigger picture than the smaller optimizations that the complier can make. Your RDC example is good case in point. Once and a while I'll be trying to optimize some critical tight piece of code or unique algorithm, but my work is mostly, now, working with people to define their business or system problem, breaking that down to a design and coding it.
Most of the efficiency and robustness comes from the overall design, efficiently representing the data for manipulation, and having a good sense of what established libraries perform the low level stuff the best. But, you can't do that if you haven't understood the basics of good code design and what you might be relying on the complier to optimize for you.
Great, thanks for that information, I'll look for the assembly file, these tiny processors are a wonderful back to basics opportunity, I'll enjoy looking at that code. Was thinking I'd use an object dumper and hope the symbol table was included in the elf file.?
I should dig deeper into the Arduino tool chain, I imagine there must be a config file where I can change the complier flags or there may still be a make file somewhere, it would be fun to shut all the optimizations off and compare the results. And force myself to go back to when it was necessary to do the optimizations yourself as a fun exercise.
Your examples for your students sound like they worked to leave an lasting impression of what you were trying to get across. It would probably be necessary to be more politically correct nowadays. But the off-the-wall examples are fun. Now days with algorithms determining who's product is shown first, whose app gets shown first in an App Store, or what ads go to the top of the page, gaming the system is prevalent. While thankfully way more subtle than your eliminating poverty example, attempts to skew the data are involved in gaming the system.
Tom, wb6b