kboye |
Oct 16, 2019 05:20 PM |
Little story about tech advances vs code optimizations from someone who just went through this days ago.
Been messing around last year making a fan controller using an Arduino Uno. My EEPROM storage/persistent budget was about 1000 bytes, my RAM (SRAM) limit for variables/RAM structure the same as structure itself is cached to avoid spamming the EEPROM wasting limited writes. I have 6 fans with labels (12 bytes per), min/max temp&PWM duty per fan, 8 temp sensor (labels, connections per fan), serial buffering and coms with a C# panel to control the thing, the code itself takes up about 25KB of Flash. I think I can use 10 fans and 16 sensors, but at that point I run out of onboard PWM or RPM IO. Thing boots in 1 second and after setting it up runs by itself.
It felt real good as a programmer to flex my brain a little and think bits and compact data again, hacking around to squeeze 16 bytes down to 2, experiencing overflow when I was running out of SRAM or EEPROM. Controller does more than anything I can buy right now, without software, relying on physical sensors. Using interrupts to avoid halting execution, queue system for polling. I'm happy :D Still got alot more to learn and optimize.
Yesterday I got a Teensy 3.6. It has around 250 000 bytes more SRAM instead of the total 2000 I was used to, ~1000KB of Flash vs 32. It's quick.
It is completely overkill, except the 60+ IO which I needed.
Point being: I got no idea if I want to use it, too quick a performance leap to make elegant use of it. I know I would be able to make the code more easily understandable and be easier to modify later on by not having to rely on hacks, bit packing etc. I also know it works just the same on this puny thing I got now running at.. What, 16MHz vs 180MHz on the Teensy? I know if I make that transition, I'll probably start getting lazy again and not need to optimize.
Not sure I'm ready for this just yet :D
Same thing when developing something on desktop, then tweaking it for phones. Instead of 4k textures, suddenly I find myself doing a single 2x2 pixel thing and limiting FPS to avoid overheating the over-agile iPhone that jystcwants to push pixels faster than is good for it :lol:
|