Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

PrevUpHomeNext

Performance

Benchmarks of BOOST_METAPARSE_STRING
Measuring printf
Further measurements

Measurements related to the performance of the BOOST_METAPARSE_STRING macro.

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.

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.

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.

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 -std=c++0x and no optimisation. Compilation speed was measured using the time utility.

To measure a non-trivial parser, the printf example program were used for measurements. Here is a list of the printf calls and their compilation speed (user output of time):

Table 22.1. Printf compilation speed

type-safe printf call

Compilation speed (s)

No compile-time parsing (just the includes and an empty main)

3.51

printf<BOOST_METAPARSE_STRING("%f")>(1.0)

4.95

printf<BOOST_METAPARSE_STRING("%f%f")>(1.0, 2.0)

5.26

printf<BOOST_METAPARSE_STRING("%f%f%f")>(1.0, 2.0, 3.0)

5.50

printf<BOOST_METAPARSE_STRING("%f%f%f%f")>(1.0, 2.0, 3.0, 4.0)

5.82

printf<BOOST_METAPARSE_STRING("%f%f%f%f%f")>(1.0, 2.0, 3.0, 4.0, 5.0)

6.07


Further measurements can be found in the following paper:

Zoltán Porkoláb, Ábel Sinkovics:
Domain-specific Language Integration with Compile-time Parser Generator Library
In Eelco Visser, Jaakko Järvi, editors, Proceedings of the ninth international conference on Generative programming and component engineering (GPCE 2010). ACM, October 2010, pp. 137-146.


PrevUpHomeNext