Divide & Conquer divides, but doesn't conquer

Timon Gehr timon.gehr at gmx.ch
Mon May 25 17:23:50 UTC 2020


On 25.05.20 19:21, Stefan Koch wrote:
> On Monday, 25 May 2020 at 17:16:12 UTC, Timon Gehr wrote:
>> On 25.05.20 18:57, Stefan Koch wrote:
>>> On Monday, 25 May 2020 at 16:46:16 UTC, Timon Gehr wrote:
>>>> On 25.05.20 18:04, Andrei Alexandrescu wrote:
>>>>> [...]
>>>>
>>>> QoI. The original `static foreach` implementation in my compiler 
>>>> frontend runs in linear time, even though it is implemented in a 
>>>> very similar way. Note that even `iota(n).array` has superlinear 
>>>> running time with DMD's CTFE.
>>>>
>>>> [...]
>>>
>>> What do you do about the scopes?
>>
>> Nothing special. Why would I have to?
> 
> You need a manifest constant for you IV (induction variable), no?
> Which would clash with the one previously introduced.
> 

Sure, so I create one forwarding scope per iteration. This is not 
particularly expensive, it's constant overhead per iteration.


More information about the Digitalmars-d mailing list