[swift-evolution] [Review] SE-0078: Implement a rotate algorithm, equivalent to std::rotate() in C++
Nate Cook
nate at natecook.com
Fri May 6 17:20:49 CDT 2016
> On May 6, 2016, at 4:20 PM, Dave Abrahams via swift-evolution <swift-evolution at swift.org> 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
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
More information about the swift-evolution
mailing list