Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Performance

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 20.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