The results below can only give a rough estimate of the resources necessary for using certain library functions. There is a number of factors which can both increase or reduce the effort required:
Expenses for preparation of operands and their stack are not considered.
In the table, the size includes all additional functions (for example, function to multiply two integers) but they are only linked from the library.
Expenses of time of performance of some functions essentially depend on parameters of a call, for example, qsort() is recursive, and sprintf() receives parameters in a stack.
Different versions of the compiler can give a significant difference in code size and execution time. For example, the dtostre() function, compiled with avr-gcc 3.4.6, requires 930 bytes. After transition to avr-gcc 4.2.3, the size become 1088 bytes.
Avr-gcc version is 4.7.1
The size of function is given in view of all picked up functions. By default Avr-libc is compiled with -mcall-prologues
option. In brackets the size without taking into account modules of a prologue and an epilogue is resulted. Both of the size can coincide, if function does not cause a prologue/epilogue.
The table contains the number of MCU clocks to calculate a function with a given argument(s). The main reason of a big difference between Avr2 and Avr4 is a hardware multiplication.
Function |
Avr2 |
Avr4 |
---|---|---|
__addsf3 (1.234, 5.678) |
113 |
108 |
__mulsf3 (1.234, 5.678) |
375 |
138 |
__divsf3 (1.234, 5.678) |
466 |
465 |
acos (0.54321) |
4411 |
2455 |
asin (0.54321) |
4517 |
2556 |
atan (0.54321) |
4710 |
2271 |
atan2 (1.234, 5.678) |
5270 |
2857 |
cbrt (1.2345) |
2684 |
2555 |
ceil (1.2345) |
177 |
177 |
cos (1.2345) |
3387 |
1671 |
cosh (1.2345) |
4922 |
2979 |
exp (1.2345) |
4708 |
2765 |
fdim (5.678, 1.234) |
111 |
111 |
floor (1.2345) |
180 |
180 |
fmax (1.234, 5.678) |
39 |
37 |
fmin (1.234, 5.678) |
35 |
35 |
fmod (5.678, 1.234) |
131 |
131 |
frexp (1.2345, 0) |
42 |
41 |
hypot (1.234, 5.678) |
1341 |
866 |
ldexp (1.2345, 6) |
42 |
42 |
log (1.2345) |
4142 |
2134 |
log10 (1.2345) |
4498 |
2260 |
modf (1.2345, 0) |
433 |
429 |
pow (1.234, 5.678) |
9293 |
5047 |
round (1.2345) |
150 |
150 |
sin (1.2345) |
3353 |
1653 |
sinh (1.2345) |
4946 |
3003 |
sqrt (1.2345) |
494 |
492 |
tan (1.2345) |
4381 |
2426 |
tanh (1.2345) |
5126 |
3173 |
trunc (1.2345) |
178 |
178 |