Boost logo

Boost :

Subject: Re: [boost] Metaprogram benchmarks
From: Dave Abrahams (dave_at_[hidden])
Date: 2012-04-04 16:04:55

on Wed Apr 04 2012, Karsten Ahnert <> wrote:

> On 04/03/2012 07:56 PM, Dave Abrahams wrote:
>> In order to measure the compile-time efficiency of various C++11
>> metaprogramming techniques, I'd like to put together a set of
>> benchmarks, and I wanted to discuss here what kinds of tests might be
>> appropriate. Aleksey and I came up with some benchmarks for an appendix
>> to, but some of those are lost and they're
>> all getting a bit crusty. Certainly, I have no confidence that they are
>> realistic or useful. If anyone has ideas about this, I'd be very
>> glad to hear them.
>> Thanks in advance,
> What about some programs and examples from this thread
> I remember that the compilation of a simple sine needed about 10 minutes
> to compile. But I am not sure if new techniques from C++11 will helf to
> increase the performance here.

Well, I happen to know that such numeric computations can be done
comparatively quickly using constexpr,
e.g. see the computation of pi in

I don't know enough about how the Van Wijngaarden method works to
identify a converged result, but IMO the techniques used there prove the
concept. Note, for example, the creation and traversal of compile-time
linked datastructures using constexpr with regular pointers :-)

Dave Abrahams
BoostPro Computing

Boost list run by bdawes at, gregod at, cpdaniel at, john at