You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
324 lines
5.1 KiB
Groff
324 lines
5.1 KiB
Groff
.TH "benchmarks" 3 "24 Jun 2019" "Version 2.0.0" "avr-libc" \" -*- nroff -*-
|
|
.ad l
|
|
.nh
|
|
.SH NAME
|
|
benchmarks \- Benchmarks
|
|
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:
|
|
.PP
|
|
.PD 0
|
|
.IP "\(bu" 2
|
|
Expenses for preparation of operands and their stack are not considered.
|
|
.PP
|
|
.PD 0
|
|
.IP "\(bu" 2
|
|
In the table, the size includes all additional functions (for example, function to multiply two integers) but they are only linked from the library.
|
|
.PP
|
|
.PD 0
|
|
.IP "\(bu" 2
|
|
Expenses of time of performance of some functions essentially depend on parameters of a call, for example, \fBqsort()\fP is recursive, and \fBsprintf()\fP receives parameters in a stack.
|
|
.PP
|
|
.PD 0
|
|
.IP "\(bu" 2
|
|
Different versions of the compiler can give a significant difference in code size and execution time. For example, the \fBdtostre()\fP function, compiled with avr-gcc 3.4.6, requires 930 bytes. After transition to avr-gcc 4.2.3, the size become 1088 bytes.
|
|
.PP
|
|
.SH "A few of libc functions."
|
|
.PP
|
|
Avr-gcc version is 4.7.1
|
|
.PP
|
|
The size of function is given in view of all picked up functions. By default Avr-libc is compiled with \fC-mcall-prologues\fP 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.
|
|
.PP
|
|
\fBFunction\fP \fBUnits\fP \fBAvr2\fP \fBAvr25\fP \fBAvr4\fP atoi ('12345') Flash bytes
|
|
.br
|
|
Stack bytes
|
|
.br
|
|
MCU clocks 82 (82)
|
|
.br
|
|
2
|
|
.br
|
|
155 78 (78)
|
|
.br
|
|
2
|
|
.br
|
|
149 74 (74)
|
|
.br
|
|
2
|
|
.br
|
|
149 atol ('12345') Flash bytes
|
|
.br
|
|
Stack bytes
|
|
.br
|
|
MCU clocks 122 (122)
|
|
.br
|
|
2
|
|
.br
|
|
221 118 (118)
|
|
.br
|
|
2
|
|
.br
|
|
219 118 (118)
|
|
.br
|
|
2
|
|
.br
|
|
219 dtostre (1.2345, s, 6, 0) Flash bytes
|
|
.br
|
|
Stack bytes
|
|
.br
|
|
MCU clocks 1116 (1004)
|
|
.br
|
|
17
|
|
.br
|
|
1247 1048 (938)
|
|
.br
|
|
17
|
|
.br
|
|
1105 1048 (938)
|
|
.br
|
|
17
|
|
.br
|
|
1105 dtostrf (1.2345, 15, 6, s) Flash bytes
|
|
.br
|
|
Stack bytes
|
|
.br
|
|
MCU clocks 1616 (1616)
|
|
.br
|
|
38
|
|
.br
|
|
1634 1508 (1508)
|
|
.br
|
|
38
|
|
.br
|
|
1462 1508 (1508)
|
|
.br
|
|
38
|
|
.br
|
|
1462 itoa (12345, s, 10) Flash bytes
|
|
.br
|
|
Stack bytes
|
|
.br
|
|
MCU clocks 110 (110)
|
|
.br
|
|
2
|
|
.br
|
|
879 102 (102)
|
|
.br
|
|
2
|
|
.br
|
|
875 102 (102)
|
|
.br
|
|
2
|
|
.br
|
|
875 ltoa (12345L, s, 10) Flash bytes
|
|
.br
|
|
Stack bytes
|
|
.br
|
|
MCU clocks 134 (134)
|
|
.br
|
|
2
|
|
.br
|
|
1597 126 (126)
|
|
.br
|
|
2
|
|
.br
|
|
1593 126 (126)
|
|
.br
|
|
2
|
|
.br
|
|
1593 malloc (1) Flash bytes
|
|
.br
|
|
Stack bytes
|
|
.br
|
|
MCU clocks 768 (712)
|
|
.br
|
|
6
|
|
.br
|
|
215 714 (660)
|
|
.br
|
|
6
|
|
.br
|
|
201 714 (660)
|
|
.br
|
|
6
|
|
.br
|
|
201 realloc ((void *)0, 1) Flash bytes
|
|
.br
|
|
Stack bytes
|
|
.br
|
|
MCU clocks 1284 (1172)
|
|
.br
|
|
18
|
|
.br
|
|
305 1174 (1064)
|
|
.br
|
|
18
|
|
.br
|
|
286 1174 (1064)
|
|
.br
|
|
18
|
|
.br
|
|
286 qsort (s, sizeof(s), 1, cmp) Flash bytes
|
|
.br
|
|
Stack bytes
|
|
.br
|
|
MCU clocks 1252 (1140)
|
|
.br
|
|
42
|
|
.br
|
|
21996 1022 (912)
|
|
.br
|
|
42
|
|
.br
|
|
19905 1028 (918)
|
|
.br
|
|
42
|
|
.br
|
|
17541 sprintf_min (s, '%d', 12345) Flash bytes
|
|
.br
|
|
Stack bytes
|
|
.br
|
|
MCU clocks 1224 (1112)
|
|
.br
|
|
53
|
|
.br
|
|
1841 1092 (982)
|
|
.br
|
|
53
|
|
.br
|
|
1694 1088 (978)
|
|
.br
|
|
53
|
|
.br
|
|
1689 sprintf (s, '%d', 12345) Flash bytes
|
|
.br
|
|
Stack bytes
|
|
.br
|
|
MCU clocks 1614 (1502)
|
|
.br
|
|
58
|
|
.br
|
|
1647 1476 (1366)
|
|
.br
|
|
58
|
|
.br
|
|
1552 1454 (1344)
|
|
.br
|
|
58
|
|
.br
|
|
1547 sprintf_flt (s, '%e', 1.2345) Flash bytes
|
|
.br
|
|
Stack bytes
|
|
.br
|
|
MCU clocks 3228 (3116)
|
|
.br
|
|
67
|
|
.br
|
|
2573 2990 (2880)
|
|
.br
|
|
67
|
|
.br
|
|
2311 2968 (2858)
|
|
.br
|
|
67
|
|
.br
|
|
2311 sscanf_min ('12345', '%d', &i) Flash bytes
|
|
.br
|
|
Stack bytes
|
|
.br
|
|
MCU clocks 1532 (1420)
|
|
.br
|
|
55
|
|
.br
|
|
1607 1328 (1218)
|
|
.br
|
|
55
|
|
.br
|
|
1446 1328 (1218)
|
|
.br
|
|
55
|
|
.br
|
|
1446 sscanf ('12345', '%d', &i) Flash bytes
|
|
.br
|
|
Stack bytes
|
|
.br
|
|
MCU clocks 2008 (1896)
|
|
.br
|
|
55
|
|
.br
|
|
1610 1748 (1638)
|
|
.br
|
|
55
|
|
.br
|
|
1449 1748 (1638)
|
|
.br
|
|
55
|
|
.br
|
|
1449 sscanf ('point,color', '%[a-z]', s) Flash bytes
|
|
.br
|
|
Stack bytes
|
|
.br
|
|
MCU clocks 2008 (1896)
|
|
.br
|
|
86
|
|
.br
|
|
3067 1748 (1638)
|
|
.br
|
|
86
|
|
.br
|
|
2806 1748 (1638)
|
|
.br
|
|
86
|
|
.br
|
|
2806 sscanf_flt ('1.2345', '%e', &x) Flash bytes
|
|
.br
|
|
Stack bytes
|
|
.br
|
|
MCU clocks 3464 (3352)
|
|
.br
|
|
71
|
|
.br
|
|
2497 3086 (2976)
|
|
.br
|
|
71
|
|
.br
|
|
2281 3070 (2960)
|
|
.br
|
|
71
|
|
.br
|
|
2078 strtod ('1.2345', &p) Flash bytes
|
|
.br
|
|
Stack bytes
|
|
.br
|
|
MCU clocks 1632 (1520)
|
|
.br
|
|
20
|
|
.br
|
|
1235 1536 (1426)
|
|
.br
|
|
20
|
|
.br
|
|
1177 1480 (1480)
|
|
.br
|
|
21
|
|
.br
|
|
1124 strtol ('12345', &p, 0) Flash bytes
|
|
.br
|
|
Stack bytes
|
|
.br
|
|
MCU clocks 918 (806)
|
|
.br
|
|
22
|
|
.br
|
|
956 834 (724)
|
|
.br
|
|
22
|
|
.br
|
|
891 792 (792)
|
|
.br
|
|
28
|
|
.br
|
|
794
|
|
.SH "Math functions."
|
|
.PP
|
|
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.
|
|
.PP
|
|
\fBFunction\fP \fBAvr2\fP \fBAvr4\fP __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
|