summaryrefslogtreecommitdiff
path: root/doc/html/metaparse/performance.html
blob: 597f6235f82ab1cc065f6eecfd31cc8bab81b888 (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
<!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.76.1">
<link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../metaparse.html" title="Chapter&#160;20.&#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>
<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.printf_compilation_speed"></a><p class="title"><b>Table&#160;20.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"><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>
<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>