> On 11 Apr 2016, at 20:47, Taras Zakharko <[email protected]
> <mailto:[email protected]>> wrote:
>
> the question is what is faster: {self[0] < self[1]} or {$1.0 < $1.1}
Yes, you are right that this is in fact not obvious!
I’ve just measured and, though my implementation is faster, it’s advantage only
grows linearly with the length of the array:
let a = (1...100_000).shuffled
func testPerformanceOf_orderSequence() {
self.measureBlock {
self.a.orderSequence(<) // 0.464 sec
}
}
func testPerformanceOf_orderCollection() {
self.measureBlock {
self.a.orderCollection(<) // 1.067 sec
}
}
It remains only twice as fast for 10,000 and 1000 elements (below that is the
margin of error).
milos_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution