//===--- SortArrayInClass.swift -------------------------------------------===// // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2019 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See https://swift.org/LICENSE.txt for license information // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // // This benchmark is derived from user code that encountered a major // performance problem in normal usage. Contributed by Saleem // Abdulrasool (compnerd). // //===----------------------------------------------------------------------===// import TestsUtils // Specifically tests efficient access to Array subscript when the // array is a class property, but also generally tests quicksort in a // class which needs a slew of array optimizations, uniqueness, bounds // and exclusivity optimizations. public let benchmarks = [ BenchmarkInfo( name: "SortArrayInClass", runFunction: run_SortArrayInClass, tags: [.abstraction, .safetychecks, .exclusivity, .algorithm, .api, .Array]) ] let largeArraySize = 10000 class Sorter { var array: [Int] init(size: Int) { array = Array((0..