Subject: Re: [boost] [phoenix] compile-time performance
From: Thomas Heller (thom.heller_at_[hidden])
Date: 2011-09-12 16:45:43


On Mon, Sep 12, 2011 at 8:54 PM, Eric Niebler <eric_at_[hidden]> wrote:
>
> On 9/12/2011 4:06 AM, Thomas Heller wrote:
>> On Monday, September 12, 2011 02:57:21 PM Joel de Guzman wrote:
>>> For example, here is the current CT status of Phoenix2 vs Phoenix3
>>> comparing the elapsed (CT) time for the phoenix2 vs. phoenix3
>>> lambda_tests.cpp (**):
>>>
>>> MSVC 10:
>>> Phoenix2: 00:04.5
>>> Phoenix3: 00:29.9
>>>
>>> G++ 4.5:
>>> Phoenix2: 00:02.6
>>> Phoenix3: 00:04.7
>>
>> I wasn't aware that Phoenix3 was so bad under MSVC 10.
>
> Me neither. If that's the case, we have work to do.
>
>>> You all know that Phoenix2 uses Fusion exclusively. Phoenix3 uses
>>> proto, which according to Eric does not use Fusion, although IIRC
>>> the core of Phoenix3 uses some Fusion still (quick check: Thomas
>>> uses an optimized-PP version of fusion:: vector for phoenix3).
>>>
>>> Heller did a helluva perf-tweaks for Phx3 to get that number for
>>> g++ (alas, not MSVC). In fairness, I did absolutely no CT
>>> perf-tweaks for both Phoenix2 and Fusion.
>>>
>>> (** I made sure both tests have exactly the same code, so I removed
>>> the last test. I can post the exact code if need be)
>
> OK, I retract everything I said. Fusion rulez, and Proto needs help.
> Sorry for the blind accusation. Let's stop this and figure out what
> needs to be fixed.
>
>> FWIW, there are some unit tests that outperform the compile times of
>> Phoenix2 (with gcc), the current bad hit on compile times seem to
>> only occur with let, lambda and switch/case expressions.
>
> This /suggests/ to me that the core of Phx3 is sound, but that the
> implementation of let, lambda, and switch are heavy. But I'm not blaming
> Thomas. I'm just suggesting a logical place to begin an
> investigation.

FWIW, i experimented with different implementations, I even almost
identically (as far as i could) copied the phx2 implementation.
For the implementation right now I have several suspects. First of
all, i think the code of the mentioned parts is very ugly (both of V2
and V3). Second of all, there some pretty severe type transformations
going on, repeated calls to fusion::make_map etc. I am absolutely sure
that there is quite some space for improvement.

> And regardless, we should point Steven's template profiler at the code
> and see what it says. Thomas, do you want to give that a shot?

Yes, I can do that, I am swamped with work until the end of the week though.
So if anyone wants to give some hints ... feel free to do so ...