Blob Blame History Raw
<!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;23.&#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;23.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>