[PATCH][libstdc++-v3 parallel mode]

Johannes Singler singler@ira.uka.de
Thu Nov 15 08:45:00 GMT 2007


Benjamin Kosnik wrote:
> This is fine.
> 
>> +    for (int t = 0; t < k; t++)
>> +      {
>> +        if (stable)
>> +          {
>> +            if (seqs_begin[t].first == seqs_begin[t].second)
>> +              lt.insert_start_stable(*arbitrary_element, t, true);
>> +            else
>> +              lt.insert_start_stable(*seqs_begin[t].first, t, false);
>> +          }
>> +        else
>> +          {
>> +            if (seqs_begin[t].first == seqs_begin[t].second)
>> +              lt.insert_start(*arbitrary_element, t, true);
>> +            else
>> +              lt.insert_start(*seqs_begin[t].first, t, false);
>> +          }
>>        }
> 
> Code like this (and other parts of this file) makes me
> think that this loop could be peeled via a template parameter on
> the function (or lt object), and structure the code for this function as
> a stable/notstable specializations (ie, stable policy). (or as
> stable/non-stable specializations of LT.)
> 
> Just a thought.
> 
> It would probably be a lot cleaner.

You mean, completely avoiding the if(stable) and parameterizing the
whole function with it? Certainly better in terms of clarity and
performance, but might produce even more code.

We are currently investigating whether we can get rid of some of the
loser tree variants, anyway. In that approach, we can also tackle this
issue.

-- Johannes



More information about the Libstdc++ mailing list