Boost logo

Boost :

Subject: Re: [boost] boost.foreach overhead
From: David Abrahams (dave_at_[hidden])
Date: 2010-10-17 20:32:13

At Sun, 17 Oct 2010 19:12:01 +0200,
Christopher Lux wrote:
> On 10/9/2010 John Carmack of id Software wrote on his Twitter
> account: “@ID_AA_Carmack: It took 69 single steps to get past a
> BOOST_FOREACH() statement. Madness.”
> This made me think again about the overhead introduced with boost
> foreach. Is the overhead really this large as he makes it sound? Are
> there heuristics to when to use foreach according to the expected
> iteration counts?

Without more information about what he was actually doing, it's hard
to say whether his expectations are totally unrealistic or not. You
can do a BOOST_FOREACH over a container rvalue; who knows if he was
actually seeing the construction steps for the container or not? Who
knows if he was stepping by ASM instruction? I'd say that tweet is
totally inconclusive and unhelpful.

Dave Abrahams
BoostPro Computing

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