Hi Taras,

> On 11 Apr 2016, at 19:38, Taras Zakharko <taras.zakha...@uzh.ch 
> <mailto:taras.zakha...@uzh.ch>> wrote:
> 
> Your version might be faster for collection with expensive element access, 
> but it should be slower for arrays and the like, as it involves additional 
> intermediate structure allocations and copies.

No, not really. The cost of my enumeration and mapping is linear so they add 
nothing to the sorting order of complexity. Your two subscript calls inside the 
predicate, however, definitely do. In other words, your implementation will not 
be faster under any circumstances and it will in fact grow nonlinearly slower 
compared to the enumeration approach as the length of array increases…

milos

(My message appear to have bounced: I’m sorry if I end up sending multiple 
copies!)

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to