foreach thoughts

deadalnix deadalnix at gmail.com
Tue Jan 14 23:08:13 PST 2014


On Wednesday, 15 January 2014 at 02:22:22 UTC, David Nadlinger 
wrote:
> On Wednesday, 15 January 2014 at 01:42:07 UTC, Manu wrote:
>> Right, thanks for that.
>> I'm quite surprised by how bad that turned out actually, and 
>> with LDC,
>> which is usually the best at optimising that sort of thing.
>> Need to do some intensive experimentation... but this is a bit 
>> concerning.
>
> GCC might do some loop merging, I haven't checked. It's just 
> that this pattern doesn't tend to appear too much in 
> traditional C/C++ code (after all, who splits up their loops 
> into two parts just for fun?), so it could be that the LLVM 
> people just never really bothered to write a pass to merge 
> single loops that have been split (as opposed to classical loop 
> fusion, where the loop ranges are the same, but the operations 
> performed/target data different).
>
> Maybe it would be possible to implement something like this 
> fairly easily using the existing LLVM loop analyses though.
>
> David

Actually this is a useful optimization technique when you need to 
skip a lot of objects that way. See 
http://www.onversity.com/load/d-loop.pdf


More information about the Digitalmars-d mailing list