Edit: As a lot of you have pointed out, efficient can mean a lot of things. I guess when I say that the device ‘requires efficient programming’, I mean that the device does not have lots of memory or a very high CPU clock rate, and therefore needs to be programmed with these limitations in mind.
Original Question: Sometimes, to train themselves, athletes will work in higher altitude places to workout. This is because there is less air, meaning working out is much more difficult. Once athletes have gotten used to exercising in these conditions, they find doing physical work in normal altitude places much easier.
I want to do this same thing, except with software development, and more specifically, game development. I want to find some system with a low amount of RAM (in the kilobytes), low CPU clock speed, and few registers. I figure learning to program games on this kind of system would be very useful in teaching me to write efficient code. Also, it would be very fun 🙂
The systems that I have thought about programming are the old Nintendo ones; GBA, NES, SNES. But I have learned the hard way that obtaining these, then obtaining the flash cards for them are very difficult, and on the border of being illegal.
So, my question is is there a crummy device that will teach me to write efficient code that is still out there and being sold? I would like it to be a physical device, looking at my programs run on physical machines would be a lot more satisfying then watching it on an emulator, and also, emulators can be buggy.
12
You’re pretty much looking for anything with a microcontroller. You can roll your own, but you probably want to start with a pre-built board like an Arduino, PICAXE, Basic Stamp, BeagleBone, or even a robotics platform like a quadcopter or roomba.
That being said, there are many different aspects to “efficiency,” and embedded development doesn’t necessarily cover all of them. For example, some applications might be able to increase execution speed significantly by using gigabytes of RAM “inefficiently.”
1
Note that the work of a developer is much more complicate than “writing efficient code” and, by the way, writing code in general, so the comparison with athletes is strange.
Now, if for some reason you should improve specifically the efficiency of your code, without carrying about anything else, then there is no reason to search for low-grade hardware devices. Take the device you used for the last years and run the code you write in a profiler, or run it hundreds of thousands of times. Chances are that a few barely noticeable milliseconds lost due to inefficient code will have a visible impact on your benchmarks when multiplied by, say, 500 000.
In the same way, you can limit yourself to low memory (RAM) footprint, even if you have access to much more memory on your device. If you write code in C, you can probably try to fix as well some size limit for the final executable.
Advantages?
-
You still use high-quality hardware and contemporary software to write, compile and debug code.
-
You can train yourself in any programming language, learning different optimization techniques. I’m pretty sure Haskell optimization would not be the same as Java optimization.
-
You can use professional profilers which will gather precise data for you, with the ability to analyze it statistically later, see how performance of your code decreases or increases over time, etc. Moreover, you know exactly where the bottleneck is, instead of wrongly guessing it or doing premature optimization.
-
You can build in one step. Less time you waste transmitting the application from your developer device to the device you test the code on means more time spent doing something useful or fun, like writing and testing code.
-
You can adjust the parameters on the fly. 500 000 iterations of your code are too slow? You can change it to be 250 000 iterations instead.
-
Play with one limitation affecting another. For example you may want to have the fastest sort algorithm but which requires more memory, or the slower algorithm with a smaller memory footprint.