3 ms·
Although the obfuscated case is really pushing it in terms of code usability and readability, being able to write miniaturized code is really important in some
by yosyp 13y ago
Although the obfuscated case is really pushing it in terms of code usability and readability, being able to write miniaturized code is really important in some industries (ie defense projects).
Take for example the Kinetis KL02 ( http://www.engadget.com/2014/02/25/freescale-kinetis-kl03/ http://www.engadget.com/2014/02/25/freescale-kinetis-kl03/ ). With only 32KB of storage and 4KB of RAM, writing efficient code with a small footprint is important. These microprocessors can be used to make swarms of autonomous fly sized drones, and programmers that can cram more procedures into those 32KB are extremely rare and useful.
- adsr 13y agoThat could be true for other embedded projects as well, but then it's the size of the executable binary that is of concern, not necessarily the size of the source code on your development box.
- userbinator 13y agoExceptions like C++ templates exist (in which a small amount of source can expand to a huge binary), but usually there tends to be a general correlation between the size of the source and the binary. Trying to write as little source code as possible also leads to trying to find the simplest, most concise algorithm to do a particular task, and that also has effects on the binary size.
- adsr 13y agoThis isn't C++. Just adding whitespace, descriptive variable and function names and comments wouldn't add any size to the resulting binary since the code is semantically the same. Using library functions can keep your amount of lines low, but you get that back when at link time if you do static linking at least. Wouldn't you prefer maintainable code that people can easily understand. I just want this said since obfuscated minimal C code isn't the same as minified JS. Algorithms is an interesting case since you have to ask if you are optimizing for size or speed, as an example you can implement a linear search in fewer lines of code than binary search. Does that mean that linear search is a better more optimized choice. It does if you are optimizing for small executable binary size.