mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
This currently copies the array each time it swaps elements. This makes it 1500x slower than it should be to sort the array. The benchmark now runs in 15ms but should be around 10us when fully optimized. This algorithm is an interesting optimization problem involving array optimization, uniqueness, bounds checks, and exclusivity. But the general first order problem is how to modify a CoW data structure that's stored in a class property. As it stands, the property getter retains the class property around the modify accesses that checks uniqueness.
2.4 KiB
2.4 KiB