Just a question about micro timing: In my md_detect I wrote:
So, is int faster calculated or short, static or inline?
@Caefix I split this from the histogram thread, because it's really off-topic for that one.
1) It probably doesn't matter. I should stop here.
2) If you want to know for sure, you should make a test case to measure it accurately. Some code I used for histogram is
here, but understanding is required to use it.
In general, "optimizing" without measurement is not a very useful activity. I should really stop here.
3) In general, the camera ARM processors work on 32 bit ints, so shorts will be tend be slower and result in additional instructions. Making individual function return values, parameters and variables shorts will usually have a negative impact. However, this depends on the specific case, and when you're storing a lot of values, using shorts can save memory, which is also important in CHDK. To really understand the impact, disassembly can be informative.
4) Inline could be good, neutral or bad for performance, but will increase code size if the compiler actually inlines it.
5) Things that are only used in a given file should be static, but this should generally not affect performance of functions and is unrelated to inline.