Hello,
I've noticed something that I think is strange about how much program memory a sketch uses in Teensy LC versus in 3.x.
I've done several tests, they involve simply reading the program storage space and dynamic memory values that the arduino IDE shows at the end of a compilation.
I've compared the Blink example with the analogRead.ino example in my ADC library. My initial objective was to know how "efficient" my code is.
These are the results for all boards, using the default options when you select the board in the arduino IDE (except to change from optimized to non-optimized):
The RAM usage makes sense, non-optimized versions use the same ammount +-2 words. The optimized versions use much more, but again similar to each other.
It's the program memory that doesn't make much sense. The (non-optimized) analogRead example uses 5 kB in Teensy 3.0, 9 in 3.1 and about 11 kB in LC!! The optimized version of LC uses 14 kB while the 3.1 one 6 kB!
Why does LC in general use so much program space?
I've noticed something that I think is strange about how much program memory a sketch uses in Teensy LC versus in 3.x.
I've done several tests, they involve simply reading the program storage space and dynamic memory values that the arduino IDE shows at the end of a compilation.
I've compared the Blink example with the analogRead.ino example in my ADC library. My initial objective was to know how "efficient" my code is.
These are the results for all boards, using the default options when you select the board in the arduino IDE (except to change from optimized to non-optimized):
Teensy 3.0 | Progmem abs / B | RAM abs / B | Progmem rel | RAM rel |
Blink | 9.508 | 2.172 | 7% | 13% |
analogRead | 15.252 | 2.304 | 11% | 14% |
Difference | 5.744 | 132 | ||
Teensy 3.1 optimized (default) | Progmem abs / B | RAM abs / B | Progmem rel | RAM rel |
Blink | 12.268 | 3.508 | 4% | 5% |
analogRead | 21.512 | 4.624 | 8% | 7% |
Difference | 6.176 | 136 | ||
Teensy 3.1 non-optimized | Progmem abs / B | RAM abs / B | Progmem rel | RAM rel |
Blink | 9.844 | 2.428 | 3% | 3% |
analogRead | 16.020 | 2.564 | 6% | 3% |
Difference | 9.244 | 1.116 | ||
Teensy LC non-optimized (default) | Progmem abs / B | RAM abs / B | Progmem rel | RAM rel |
Blink | 10.076 | 2.176 | 15% | 26% |
analogRead | 21.196 | 2.304 | 33% | 28% |
Difference | 11.120 | 128 | ||
Teensy LC optimized | Progmem abs / B | RAM abs / B | Progmem rel | RAM rel |
Blink | 12.188 | 3.252 | 19% | 39% |
analogRead | 26.400 | 4.364 | 41% | 53% |
Difference | 14.212 | 1.112 |
The RAM usage makes sense, non-optimized versions use the same ammount +-2 words. The optimized versions use much more, but again similar to each other.
It's the program memory that doesn't make much sense. The (non-optimized) analogRead example uses 5 kB in Teensy 3.0, 9 in 3.1 and about 11 kB in LC!! The optimized version of LC uses 14 kB while the 3.1 one 6 kB!
Why does LC in general use so much program space?