• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1[section Performance]
2
3[#BOOST_METAPARSE_STRING_benchmark]
4[section Benchmarks of BOOST_METAPARSE_STRING]
5
6Measurements related to the performance of the
7[link BOOST_METAPARSE_STRING `BOOST_METAPARSE_STRING`] macro.
8
9[section Increasing string length]
10
11[include length128_gcc_4.8.5.qbk]
12
13[endsect]
14
15[section Increasing number of strings]
16
17[include number_gcc_4.8.5.qbk]
18
19[endsect]
20
21[section Increasing string length limit]
22
23[include max_length_gcc_4.8.5.qbk]
24
25[endsect]
26
27[endsect]
28
29[section Measuring printf]
30
31Parsers work at compile-time, thus their performance affects compilation speed.
32This section shows measurements of compilation time using Metaparse. The
33measurements were done on a Linux laptop with an 1.6 GHz Atom processor and 1 GB
34memory. The measurements were done using GCC 4.6.1 with `-std=c++0x` and no
35optimisation. Compilation speed was measured using the `time` utility.
36
37To measure a non-trivial parser, the `printf` example program were used for
38measurements. Here is a list of the `printf` calls and their compilation speed
39(`user` output of `time`):
40
41[table Printf compilation speed
42  [[type-safe `printf` call] [Compilation speed (s)]]
43
44  [[No compile-time parsing (just the includes and an empty `main`)]         [3.51]]
45  [[`printf<BOOST_METAPARSE_STRING("%f")>(1.0)`]                             [4.95]]
46  [[`printf<BOOST_METAPARSE_STRING("%f%f")>(1.0, 2.0)`]                      [5.26]]
47  [[`printf<BOOST_METAPARSE_STRING("%f%f%f")>(1.0, 2.0, 3.0)`]               [5.50]]
48  [[`printf<BOOST_METAPARSE_STRING("%f%f%f%f")>(1.0, 2.0, 3.0, 4.0)`]        [5.82]]
49  [[`printf<BOOST_METAPARSE_STRING("%f%f%f%f%f")>(1.0, 2.0, 3.0, 4.0, 5.0)`] [6.07]]
50]
51
52[endsect]
53
54[section Further measurements]
55
56Further measurements can be found in the following paper:
57
58Zoltán Porkoláb, Ábel Sinkovics: [br]
59[*Domain-specific Language Integration with Compile-time Parser Generator Library] [br]
60In Eelco Visser, Jaakko Järvi, editors, Proceedings of the ninth
61international conference on Generative programming and component
62engineering (GPCE 2010). ACM, October 2010, pp. 137-146.
63
64[endsect]
65
66[endsect]
67
68