summaryrefslogtreecommitdiff
path: root/doc/html/metaparse/performance.html
blob: c519dd30fd8674d1b1c985fffe9cf7a1435797e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Performance</title>
<link rel="stylesheet" href="../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../metaparse.html" title="Chapter&#160;24.&#160;Boost.Metaparse">
<link rel="prev" href="versioning.html" title="Versioning">
<link rel="next" href="the_design_of_the_library.html" title="The design of the library">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
<td align="center"><a href="../../../index.html">Home</a></td>
<td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="versioning.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../metaparse.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="the_design_of_the_library.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="metaparse.performance"></a><a class="link" href="performance.html" title="Performance">Performance</a>
</h2></div></div></div>
<div class="toc"><dl class="toc">
<dt><span class="section"><a href="performance.html#metaparse.performance.benchmarks_of_boost_metaparse_st">Benchmarks
      of BOOST_METAPARSE_STRING</a></span></dt>
<dt><span class="section"><a href="performance.html#metaparse.performance.measuring_printf">Measuring printf</a></span></dt>
<dt><span class="section"><a href="performance.html#metaparse.performance.further_measurements">Further measurements</a></span></dt>
</dl></div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="metaparse.performance.benchmarks_of_boost_metaparse_st"></a><a name="BOOST_METAPARSE_STRING_benchmark"></a><a class="link" href="performance.html#metaparse.performance.benchmarks_of_boost_metaparse_st" title="Benchmarks of BOOST_METAPARSE_STRING">Benchmarks
      of BOOST_METAPARSE_STRING</a>
</h3></div></div></div>
<div class="toc"><dl class="toc">
<dt><span class="section"><a href="performance.html#metaparse.performance.benchmarks_of_boost_metaparse_st.increasing_string_length">Increasing
        string length</a></span></dt>
<dt><span class="section"><a href="performance.html#metaparse.performance.benchmarks_of_boost_metaparse_st.increasing_number_of_strings">Increasing
        number of strings</a></span></dt>
<dt><span class="section"><a href="performance.html#metaparse.performance.benchmarks_of_boost_metaparse_st.increasing_string_length_limit">Increasing
        string length limit</a></span></dt>
</dl></div>
<p>
        Measurements related to the performance of the <a class="link" href="reference.html#BOOST_METAPARSE_STRING"><code class="computeroutput"><span class="identifier">BOOST_METAPARSE_STRING</span></code></a> macro.
      </p>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.performance.benchmarks_of_boost_metaparse_st.increasing_string_length"></a><a class="link" href="performance.html#metaparse.performance.benchmarks_of_boost_metaparse_st.increasing_string_length" title="Increasing string length">Increasing
        string length</a>
</h4></div></div></div>
<p>
          128 strings with increasing length. Measured on a Linux-3.13.0-24-generic-x86_64-with-Ubuntu-14.04-trusty
          host with 16 GB memory. Compiler used: gcc 4.8.5.
        </p>
<p>
          <span class="inlinemediaobject"><img src="../images/metaparse/length128_gcc_4.8.5.png" width="100%"></span>
        </p>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.performance.benchmarks_of_boost_metaparse_st.increasing_number_of_strings"></a><a class="link" href="performance.html#metaparse.performance.benchmarks_of_boost_metaparse_st.increasing_number_of_strings" title="Increasing number of strings">Increasing
        number of strings</a>
</h4></div></div></div>
<p>
          Increasing number of strings with 64 length. Measured on a Linux-3.13.0-24-generic-x86_64-with-Ubuntu-14.04-trusty
          host with 16 GB memory. Compiler used: gcc 4.8.5.
        </p>
<p>
          <span class="inlinemediaobject"><img src="../images/metaparse/number_gcc_4.8.5.png" width="100%"></span>
        </p>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="metaparse.performance.benchmarks_of_boost_metaparse_st.increasing_string_length_limit"></a><a class="link" href="performance.html#metaparse.performance.benchmarks_of_boost_metaparse_st.increasing_string_length_limit" title="Increasing string length limit">Increasing
        string length limit</a>
</h4></div></div></div>
<p>
          100 one character long strings with increasing maximum length. Measured
          on a Linux-3.13.0-24-generic-x86_64-with-Ubuntu-14.04-trusty host with
          16 GB memory. Compiler used: gcc 4.8.5.
        </p>
<p>
          <span class="inlinemediaobject"><img src="../images/metaparse/max_length_gcc_4.8.5.png" width="100%"></span>
        </p>
</div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="metaparse.performance.measuring_printf"></a><a class="link" href="performance.html#metaparse.performance.measuring_printf" title="Measuring printf">Measuring printf</a>
</h3></div></div></div>
<p>
        Parsers work at compile-time, thus their performance affects compilation
        speed. This section shows measurements of compilation time using Metaparse.
        The measurements were done on a Linux laptop with an 1.6 GHz Atom processor
        and 1 GB memory. The measurements were done using GCC 4.6.1 with <code class="computeroutput"><span class="special">-</span><span class="identifier">std</span><span class="special">=</span><span class="identifier">c</span><span class="special">++</span><span class="number">0</span><span class="identifier">x</span></code> and no optimisation. Compilation speed
        was measured using the <code class="computeroutput"><span class="identifier">time</span></code>
        utility.
      </p>
<p>
        To measure a non-trivial parser, the <code class="computeroutput"><span class="identifier">printf</span></code>
        example program were used for measurements. Here is a list of the <code class="computeroutput"><span class="identifier">printf</span></code> calls and their compilation speed
        (<code class="computeroutput"><span class="identifier">user</span></code> output of <code class="computeroutput"><span class="identifier">time</span></code>):
      </p>
<div class="table">
<a name="metaparse.performance.measuring_printf.printf_compilation_speed"></a><p class="title"><b>Table&#160;24.1.&#160;Printf compilation speed</b></p>
<div class="table-contents"><table class="table" summary="Printf compilation speed">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
                <p>
                  type-safe <code class="computeroutput"><span class="identifier">printf</span></code>
                  call
                </p>
              </th>
<th>
                <p>
                  Compilation speed (s)
                </p>
              </th>
</tr></thead>
<tbody>
<tr>
<td>
                <p>
                  No compile-time parsing (just the includes and an empty <code class="computeroutput"><span class="identifier">main</span></code>)
                </p>
              </td>
<td>
                <p>
                  3.51
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">printf</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"%f"</span><span class="special">)&gt;(</span><span class="number">1.0</span><span class="special">)</span></code>
                </p>
              </td>
<td>
                <p>
                  4.95
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">printf</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"%f%f"</span><span class="special">)&gt;(</span><span class="number">1.0</span><span class="special">,</span> <span class="number">2.0</span><span class="special">)</span></code>
                </p>
              </td>
<td>
                <p>
                  5.26
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">printf</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"%f%f%f"</span><span class="special">)&gt;(</span><span class="number">1.0</span><span class="special">,</span> <span class="number">2.0</span><span class="special">,</span> <span class="number">3.0</span><span class="special">)</span></code>
                </p>
              </td>
<td>
                <p>
                  5.50
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">printf</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"%f%f%f%f"</span><span class="special">)&gt;(</span><span class="number">1.0</span><span class="special">,</span> <span class="number">2.0</span><span class="special">,</span> <span class="number">3.0</span><span class="special">,</span> <span class="number">4.0</span><span class="special">)</span></code>
                </p>
              </td>
<td>
                <p>
                  5.82
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">printf</span><span class="special">&lt;</span><span class="identifier">BOOST_METAPARSE_STRING</span><span class="special">(</span><span class="string">"%f%f%f%f%f"</span><span class="special">)&gt;(</span><span class="number">1.0</span><span class="special">,</span> <span class="number">2.0</span><span class="special">,</span> <span class="number">3.0</span><span class="special">,</span> <span class="number">4.0</span><span class="special">,</span> <span class="number">5.0</span><span class="special">)</span></code>
                </p>
              </td>
<td>
                <p>
                  6.07
                </p>
              </td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break">
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="metaparse.performance.further_measurements"></a><a class="link" href="performance.html#metaparse.performance.further_measurements" title="Further measurements">Further measurements</a>
</h3></div></div></div>
<p>
        Further measurements can be found in the following paper:
      </p>
<p>
        Zolt&#225;n Porkol&#225;b, &#193;bel Sinkovics: <br> <span class="bold"><strong>Domain-specific
        Language Integration with Compile-time Parser Generator Library</strong></span>
        <br> In Eelco Visser, Jaakko J&#228;rvi, editors, Proceedings of the ninth
        international conference on Generative programming and component engineering
        (GPCE 2010). ACM, October 2010, pp. 137-146.
      </p>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2015 Abel Sinkovics<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="versioning.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../metaparse.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="the_design_of_the_library.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>