Performance of array sorting in Swift Beta: why is it so slow and how to speed it up?
Hello everyone! I just started learning Swift and encountered a very strange problem when sorting arrays in Xcode 6 Beta.\n\nI have a simple array of integers, and I want to sort it in descending order. I wrote this code:\n\n```swift\nvar numbers = [9, 3, 5, 1, 8, 2, 7, 4, 6]\nnumbers.sort { $0 > $1 }\n```\n\nSeems logical enough. But when I run this code on a large array (say, 100,000 elements), sorting takes forever — about 4-5 seconds! And if I do the same thing in Objective-C with `sortedArrayUsingComparator:`, it works instantly (less than 0.1 seconds).\n\nI tried different options:\n\n1. `numbers.sort(>)` — same slowness.\n2. `numbers.sorted(by: >)` — returns a new array, but also slow.\n3. Even a simple `numbers.sort()` without a closure — still