1<html> 2<head> 3<!-- Generated by the Spirit (http://spirit.sf.net) QuickDoc --> 4<title>Efficiency</title> 5<link rel="stylesheet" href="theme/style.css" type="text/css"> 6<link rel="prev" href="lazy_construction.html"> 7<link rel="next" href="inside_phoenix.html"> 8</head> 9<body> 10<table width="100%" height="48" border="0" background="theme/bkd2.gif" cellspacing="2"> 11 <tr> 12 <td width="10"> 13 </td> 14 <td width="85%"> 15 <font size="6" face="Verdana, Arial, Helvetica, sans-serif"><b>Efficiency</b></font> 16 </td> 17 <td width="112"><a href="http://spirit.sf.net"><img src="theme/spirit.gif" align="right" border="0"></a></td> 18 </tr> 19</table> 20<br> 21<table border="0"> 22 <tr> 23 <td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> 24 <td width="30"><a href="lazy_construction.html"><img src="theme/l_arr.gif" border="0"></a></td> 25 <td width="20"><a href="inside_phoenix.html"><img src="theme/r_arr.gif" border="0"></a></td> 26 </tr> 27</table> 28<p> 29Now this is important. Operators that form expressions and statements, while truly expressive, should be used judiciously and sparingly. While aggressive compiler optimizations and inline code helps a lot to produce tighter and faster code, lazy operators and statements will always have more overhead compared to lazy- functions and bound simple functors especially when the logic gets to be quite complex. It is not only run-time code that hits a penalty, complex expressions involving lazy-operators and lazy- functions are also much more difficult to parse and compile by the host C++ compiler and results in much longer compile times.</p> 30<table width="80%" border="0" align="center"> 31 <tr> 32 <td class="note_box"> 33<img src="theme/bulb.gif"></img> <b>Lambda vs. Offline Functions</b><br><br>The best way to use the framework is to write generic off-line lazy functions (see functions) then call these functions lazily using straight-forward inline lazy-operators and lazy-statements. </td> 34 </tr> 35</table> 36<p> 37While it is indeed satisfying to impress others with quite esoteric uses of operator overloading and generative programming as can be done by lazy-operators and lazy-statements, these tools are meant to be used for the right job. That said, caveat-emptor.</p> 38<table width="80%" border="0" align="center"> 39 <tr> 40 <td class="note_box"> 41<img src="theme/note.gif"></img> need benchmarks, benchmarks, and more benchmarks </td> 42 </tr> 43</table> 44<table border="0"> 45 <tr> 46 <td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> 47 <td width="30"><a href="lazy_construction.html"><img src="theme/l_arr.gif" border="0"></a></td> 48 <td width="20"><a href="inside_phoenix.html"><img src="theme/r_arr.gif" border="0"></a></td> 49 </tr> 50</table> 51<br> 52<hr size="1"> 53<p class="copyright">Copyright © 2001-2002 Joel de Guzman<br> 54 <br> 55<font size="2">Use, modification and distribution is subject to the Boost Software 56 License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 57 http://www.boost.org/LICENSE_1_0.txt) </font> </p> 58</body> 59</html> 60