> On May 6, 2016, at 4:20 PM, Dave Abrahams via swift-evolution 
> <[email protected]> wrote:
> 
>> on Fri May 06 2016, Nate Cook <natecook-AT-gmail.com> wrote:
>> 
>>    How can you reverse a variable-length collection with a fixed number of
>>    iterations? Are you talking about loop unrolling in the library?
>> 
>> I mean looping count / 2 times instead of looping while lowIndex <
>> highIndex,
> 
> Why do you think that will be faster?

I don't know what kinds of optimization the compiler performs, but it certainly 
seems more open to optimization. Barring that, it removes the custom index 
comparison, which certainly couldn't be faster than checking for the end of a 
loop. 

If it's not an improvement over the bidirectional algorithm, let's leave it 
out. Then we could skip the customization method and only have reverse() as an 
extension to BidirectionalCollection.

Nate


> -- 
> Dave
> _______________________________________________
> swift-evolution mailing list
> [email protected]
> https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to