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

This is the documentation for an old version of Boost. Click here to view this page for the latest version.


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)




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


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


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


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


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.