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.
304 lines
9.0 KiB
HTML
304 lines
9.0 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
|
<title>avr-libc: Benchmarks</title>
|
|
<link href="dox.css" rel="stylesheet" type="text/css">
|
|
</head>
|
|
<body>
|
|
<center>
|
|
<table width="80%">
|
|
<tr>
|
|
<td align="left"><a href="http://www.nongnu.org/avr-libc/">AVR Libc Home Page</a></td>
|
|
<td align="center" colspan=4><img src="avrs.png" alt="AVRs" align="middle" border="0"></td>
|
|
<td align="right"><a href="https://savannah.nongnu.org/projects/avr-libc/">AVR Libc Development Pages</a></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="center" width="13%"><a href="index.html">Main Page</a></td>
|
|
<td align="center" width="13%"><a href="pages.html">User Manual</a></td>
|
|
<td align="center" width="13%"><a href="modules.html">Library Reference</a></td>
|
|
<td align="center" width="13%"><a href="FAQ.html">FAQ</a></td>
|
|
<td align="center" width="13%"><a href="globals.html">Alphabetical Index</a></td>
|
|
<td align="center" width="13%"><a href="group__demos.html">Example Projects</a></td>
|
|
</tr>
|
|
</table>
|
|
</center>
|
|
<hr width="80%">
|
|
<!-- Generated by Doxygen 1.5.6 -->
|
|
<div class="contents">
|
|
<h1><a class="anchor" name="benchmarks">Benchmarks </a></h1>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:<p>
|
|
<ul>
|
|
<li>Expenses for preparation of operands and their stack are not considered.</li>
|
|
</ul>
|
|
<ul>
|
|
<li>In the table, the size includes all additional functions (for example, function to multiply two integers) but they are only linked from the library.</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Expenses of time of performance of some functions essentially depend on parameters of a call, for example, <a class="el" href="group__avr__stdlib.html#gfd4bf2faec43342e7ad3d2ab37bac1fe">qsort()</a> is recursive, and <a class="el" href="group__avr__stdio.html#g6017094d9fd800fa02600d35399f2a2a">sprintf()</a> receives parameters in a stack.</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Different versions of the compiler can give a significant difference in code size and execution time. For example, the <a class="el" href="group__avr__stdlib.html#g6c140bdd3b9bd740a1490137317caa44">dtostre()</a> function, compiled with avr-gcc 3.4.6, requires 930 bytes. After transition to avr-gcc 4.2.3, the size become 1088 bytes.</li>
|
|
</ul>
|
|
<h2><a class="anchor" name="bench_libc">
|
|
A few of libc functions.</a></h2>
|
|
Avr-gcc version is 4.2.3<p>
|
|
The size of function is given in view of all picked up functions. By default Avr-libc is compiled with <code>-mcall-prologues</code> 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.<p>
|
|
<small> <table border="1" cellspacing="3" cellpadding="3">
|
|
<tr>
|
|
<td width="50%"><b>Function</b> </td><td width="20%"><b>Units</b> </td><td width="10%"><b>Avr2</b> </td><td width="10%"><b>Avr25</b> </td><td width="10%"><b>Avr4</b> </td></tr>
|
|
<tr>
|
|
<td>atoi ("12345") </td><td>Flash bytes<br>
|
|
Stack bytes<br>
|
|
MCU clocks </td><td>82 (82)<br>
|
|
2<br>
|
|
155 </td><td>78 (78)<br>
|
|
<br>
|
|
</td><td>74 (74)<br>
|
|
2<br>
|
|
149 </td></tr>
|
|
<tr>
|
|
<td>atol ("12345") </td><td>Flash bytes<br>
|
|
Stack bytes<br>
|
|
MCU clocks </td><td>122 (122)<br>
|
|
2<br>
|
|
221 </td><td>118 (118)<br>
|
|
<br>
|
|
</td><td>118 (118)<br>
|
|
2<br>
|
|
219 </td></tr>
|
|
<tr>
|
|
<td>dtostre (1.2345, s, 6, 0) </td><td>Flash bytes<br>
|
|
Stack bytes<br>
|
|
MCU clocks </td><td>1184 (1072)<br>
|
|
17<br>
|
|
1313 </td><td>1088 (978)<br>
|
|
<br>
|
|
</td><td>1088 (978)<br>
|
|
17<br>
|
|
1152 </td></tr>
|
|
<tr>
|
|
<td>dtostrf (1.2345, 15, 6, s) </td><td>Flash bytes<br>
|
|
Stack bytes<br>
|
|
MCU clocks </td><td>1676 (1564)<br>
|
|
36<br>
|
|
1608 </td><td>1548 (1438)<br>
|
|
<br>
|
|
</td><td>1548 (1438)<br>
|
|
36<br>
|
|
1443 </td></tr>
|
|
<tr>
|
|
<td>itoa (12345, s, 10) </td><td>Flash bytes<br>
|
|
Stack bytes<br>
|
|
MCU clocks </td><td>150 (150)<br>
|
|
4<br>
|
|
1172 </td><td>134 (134)<br>
|
|
<br>
|
|
</td><td>134 (134)<br>
|
|
4<br>
|
|
1152 </td></tr>
|
|
<tr>
|
|
<td>ltoa (12345L, s, 10) </td><td>Flash bytes<br>
|
|
Stack bytes<br>
|
|
MCU clocks </td><td>220 (220)<br>
|
|
9<br>
|
|
3174 </td><td>200 (200)<br>
|
|
<br>
|
|
</td><td>200 (200)<br>
|
|
9<br>
|
|
3136 </td></tr>
|
|
<tr>
|
|
<td>malloc (1) </td><td>Flash bytes<br>
|
|
Stack bytes<br>
|
|
MCU clocks </td><td>554 (554)<br>
|
|
4<br>
|
|
196 </td><td>506 (506)<br>
|
|
<br>
|
|
</td><td>506 (506)<br>
|
|
4<br>
|
|
178 </td></tr>
|
|
<tr>
|
|
<td>realloc ((void *)0, 1) </td><td>Flash bytes<br>
|
|
Stack bytes<br>
|
|
MCU clocks </td><td>1152 (1040)<br>
|
|
20<br>
|
|
303 </td><td>1042 (932)<br>
|
|
<br>
|
|
</td><td>1042 (932)<br>
|
|
20<br>
|
|
280 </td></tr>
|
|
<tr>
|
|
<td>qsort (s, sizeof(s), 1, cmp) </td><td>Flash bytes<br>
|
|
Stack bytes<br>
|
|
MCU clocks </td><td>1242 (1130)<br>
|
|
38<br>
|
|
20914 </td><td>990 (880)<br>
|
|
<br>
|
|
</td><td>1008 (898)<br>
|
|
38<br>
|
|
16678 </td></tr>
|
|
<tr>
|
|
<td>sprintf_min (s, "%d", 12345) </td><td>Flash bytes<br>
|
|
Stack bytes<br>
|
|
MCU clocks </td><td>1216 (1104)<br>
|
|
59<br>
|
|
1846 </td><td>1090 (980)<br>
|
|
<br>
|
|
</td><td>1086 (976)<br>
|
|
59<br>
|
|
1711 </td></tr>
|
|
<tr>
|
|
<td>sprintf (s, "%d", 12345) </td><td>Flash bytes<br>
|
|
Stack bytes<br>
|
|
MCU clocks </td><td>1674 (1562)<br>
|
|
58<br>
|
|
1610 </td><td>1542 (1432)<br>
|
|
<br>
|
|
</td><td>1498 (1388)<br>
|
|
58<br>
|
|
1528 </td></tr>
|
|
<tr>
|
|
<td>sprintf_flt (s, "%e", 1.2345) </td><td>Flash bytes<br>
|
|
Stack bytes<br>
|
|
MCU clocks </td><td>3334 (3222)<br>
|
|
66<br>
|
|
2513 </td><td>3084 (2974)<br>
|
|
<br>
|
|
</td><td>3040 (2930)<br>
|
|
66<br>
|
|
2297 </td></tr>
|
|
<tr>
|
|
<td>sscanf_min ("12345", "%d", &i) </td><td>Flash bytes<br>
|
|
Stack bytes<br>
|
|
MCU clocks </td><td>1540 (1428)<br>
|
|
55<br>
|
|
1339 </td><td>1354 (1244)<br>
|
|
<br>
|
|
</td><td>1354 (1244)<br>
|
|
55<br>
|
|
1240 </td></tr>
|
|
<tr>
|
|
<td>sscanf ("12345", "%d", &i) </td><td>Flash bytes<br>
|
|
Stack bytes<br>
|
|
MCU clocks </td><td>1950 (1838)<br>
|
|
53<br>
|
|
1334 </td><td>1704 (1594)<br>
|
|
<br>
|
|
</td><td>1704 (1594)<br>
|
|
53<br>
|
|
1235 </td></tr>
|
|
<tr>
|
|
<td>sscanf ("point,color", "%[a-z]", s) </td><td>Flash bytes<br>
|
|
Stack bytes<br>
|
|
MCU clocks </td><td>1950 (1838)<br>
|
|
87<br>
|
|
2878 </td><td>1704 (1594)<br>
|
|
<br>
|
|
</td><td>1704 (1594)<br>
|
|
87<br>
|
|
2718 </td></tr>
|
|
<tr>
|
|
<td>sscanf_flt ("1.2345", "%e", &x) </td><td>Flash bytes<br>
|
|
Stack bytes<br>
|
|
MCU clocks </td><td>3298 (3186)<br>
|
|
63<br>
|
|
2187 </td><td>2934 (2824)<br>
|
|
<br>
|
|
</td><td>2918 (2808)<br>
|
|
63<br>
|
|
1833 </td></tr>
|
|
<tr>
|
|
<td>strtod ("1.2345", &p) </td><td>Flash bytes<br>
|
|
Stack bytes<br>
|
|
MCU clocks </td><td>1570 (1458)<br>
|
|
22<br>
|
|
1237 </td><td>1472 (1362)<br>
|
|
<br>
|
|
</td><td>1456 (1346)<br>
|
|
22<br>
|
|
971 </td></tr>
|
|
<tr>
|
|
<td>strtol ("12345", &p, 0) </td><td>Flash bytes<br>
|
|
Stack bytes<br>
|
|
MCU clocks </td><td>942 (830)<br>
|
|
29<br>
|
|
1074 </td><td>874 (764)<br>
|
|
<br>
|
|
</td><td>808 (698)<br>
|
|
21<br>
|
|
722 </td></tr>
|
|
</table>
|
|
</small><h2><a class="anchor" name="bench_libm">
|
|
Math functions.</a></h2>
|
|
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.<p>
|
|
<table border="1" cellspacing="3" cellpadding="3">
|
|
<tr>
|
|
<td width="50%"><b>Function</b> </td><td width="25%"><b>Avr2</b> </td><td width="25%"><b>Avr4</b> </td></tr>
|
|
<tr>
|
|
<td>__addsf3 (1.234, 5.678) </td><td>113 </td><td>108 </td></tr>
|
|
<tr>
|
|
<td>__mulsf3 (1.234, 5.678) </td><td>375 </td><td>138 </td></tr>
|
|
<tr>
|
|
<td>__divsf3 (1.234, 5.678) </td><td>466 </td><td>465 </td></tr>
|
|
<tr>
|
|
<td>acos (0.54321) </td><td>4648 </td><td>2689 </td></tr>
|
|
<tr>
|
|
<td>asin (0.54321) </td><td>4754 </td><td>2790 </td></tr>
|
|
<tr>
|
|
<td>atan (0.54321) </td><td>4710 </td><td>2271 </td></tr>
|
|
<tr>
|
|
<td>atan2 (1.234, 5.678) </td><td>5270 </td><td>2857 </td></tr>
|
|
<tr>
|
|
<td>ceil (1.2345) </td><td>177 </td><td>177 </td></tr>
|
|
<tr>
|
|
<td>cos (1.2345) </td><td>3381 </td><td>1665 </td></tr>
|
|
<tr>
|
|
<td>cosh (1.2345) </td><td>4922 </td><td>2979 </td></tr>
|
|
<tr>
|
|
<td>exp (1.2345) </td><td>4708 </td><td>2765 </td></tr>
|
|
<tr>
|
|
<td>fdim (5.678, 1.234) </td><td>111 </td><td>111 </td></tr>
|
|
<tr>
|
|
<td>floor (1.2345) </td><td>180 </td><td>180 </td></tr>
|
|
<tr>
|
|
<td>fmax (1.234, 5.678) </td><td>39 </td><td>37 </td></tr>
|
|
<tr>
|
|
<td>fmin (1.234, 5.678) </td><td>35 </td><td>35 </td></tr>
|
|
<tr>
|
|
<td>fmod (5.678, 1.234) </td><td>132 </td><td>132 </td></tr>
|
|
<tr>
|
|
<td>frexp (1.2345, 0) </td><td>37 </td><td>36 </td></tr>
|
|
<tr>
|
|
<td>hypot (1.234, 5.678) </td><td>1556 </td><td>1078 </td></tr>
|
|
<tr>
|
|
<td>ldexp (1.2345, 6) </td><td>42 </td><td>42 </td></tr>
|
|
<tr>
|
|
<td>log (1.2345) </td><td>4142 </td><td>2134 </td></tr>
|
|
<tr>
|
|
<td>log10 (1.2345) </td><td>4498 </td><td>2260 </td></tr>
|
|
<tr>
|
|
<td>modf (1.2345, 0) </td><td>433 </td><td>429 </td></tr>
|
|
<tr>
|
|
<td>pow (1.234, 5.678) </td><td>9293 </td><td>5047 </td></tr>
|
|
<tr>
|
|
<td>round (1.2345) </td><td>150 </td><td>150 </td></tr>
|
|
<tr>
|
|
<td>sin (1.2345) </td><td>3347 </td><td>1647 </td></tr>
|
|
<tr>
|
|
<td>sinh (1.2345) </td><td>4946 </td><td>3003 </td></tr>
|
|
<tr>
|
|
<td>sqrt (1.2345) </td><td>709 </td><td>704 </td></tr>
|
|
<tr>
|
|
<td>tan (1.2345) </td><td>4375 </td><td>2420 </td></tr>
|
|
<tr>
|
|
<td>tanh (1.2345) </td><td>5126 </td><td>3173 </td></tr>
|
|
<tr>
|
|
<td>trunc (1.2345) </td><td>178 </td><td>178 </td></tr>
|
|
</table>
|
|
</div>
|
|
|
|
<hr width="80%">
|
|
<p><center>Automatically generated by Doxygen 1.5.6 on 4 Dec 2008.</center></p>
|
|
|
|
</body>
|
|
</html>
|