From 94d94ee2f5a8415df8b6ebbda32cda267da83a10 Mon Sep 17 00:00:00 2001 From: Pavol Vaskovic Date: Wed, 14 Nov 2018 11:00:58 +0100 Subject: [PATCH 01/12] [benchmark] Rehouse DistinctClassFieldAccesses MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Benchmark DistinctClassFieldAccesses was added in a strange place… See https://github.com/apple/swift/pull/18892/files#r212038958 Per discussion in in https://github.com/apple/swift/pull/18892#issuecomment-435695071 I’m moving it to the extremely similar `ArrayInClass`, while fixing its workload size (and loop pattern) to make it relatively comparable. --- benchmark/single-source/ArrayInClass.swift | 54 ++++++++++++++++--- .../ExistentialPerformance.swift | 39 -------------- 2 files changed, 48 insertions(+), 45 deletions(-) diff --git a/benchmark/single-source/ArrayInClass.swift b/benchmark/single-source/ArrayInClass.swift index 3aa94d0111905..27360590592e8 100644 --- a/benchmark/single-source/ArrayInClass.swift +++ b/benchmark/single-source/ArrayInClass.swift @@ -11,12 +11,19 @@ //===----------------------------------------------------------------------===// import TestsUtils -public let ArrayInClass = BenchmarkInfo( - name: "ArrayInClass", - runFunction: run_ArrayInClass, - tags: [.validation, .api, .Array], - setUpFunction: { ac = ArrayContainer() }, - tearDownFunction: { ac = nil }) +public let ArrayInClass = [ + BenchmarkInfo( + name: "ArrayInClass", + runFunction: run_ArrayInClass, + tags: [.validation, .api, .Array], + setUpFunction: { ac = ArrayContainer() }, + tearDownFunction: { ac = nil }), + BenchmarkInfo(name: "DistinctClassFieldAccesses", + runFunction: run_DistinctClassFieldAccesses, + tags: [.unstable, .api, .Array], + setUpFunction: { workload = ClassWithArrs(N: 100_000) }, + tearDownFunction: { workload = nil }), +] var ac: ArrayContainer! @@ -41,3 +48,38 @@ public func run_ArrayInClass(_ N: Int) { let a = ac! a.runLoop(N) } + +class ClassWithArrs { + var N: Int = 0 + var A: [Int] + var B: [Int] + + init(N: Int) { + self.N = N + + A = [Int](repeating: 0, count: N) + B = [Int](repeating: 0, count: N) + } + + func readArr() { + for i in 0.. Bool From ae4ecbe8b652a30110a3e8f3e1c9939eb564cf4e Mon Sep 17 00:00:00 2001 From: Pavol Vaskovic Date: Wed, 14 Nov 2018 11:09:44 +0100 Subject: [PATCH 02/12] [benchmark] Adjust Existential workload sizes Reduced base workloads. This allows precise measurements without the noise of accumulated error from unnecessarily long runtimes. --- .../ExistentialPerformance.swift | 102 +++++++----------- 1 file changed, 40 insertions(+), 62 deletions(-) diff --git a/benchmark/single-source/ExistentialPerformance.swift b/benchmark/single-source/ExistentialPerformance.swift index 67f68c86a2220..486ce864a30ab 100644 --- a/benchmark/single-source/ExistentialPerformance.swift +++ b/benchmark/single-source/ExistentialPerformance.swift @@ -319,22 +319,18 @@ func passExistentialTwiceTwoMethodCalls(_ e0: Existential, _ e1: Existential) -> func runTestOneMethodCall(withType: T.Type, numberOfTimes N: Int) { let existential = initExistential(withType: T.self) - for _ in 0 ..< N { - for _ in 0 ..< 5_000_000 { - if !existential.doIt() { - fatalError("expected true") - } + for _ in 0 ..< N * 20_000 { + if !existential.doIt() { + fatalError("expected true") } } } func runTestTwoMethodCalls(withType: T.Type, numberOfTimes N: Int) { let existential = initExistential(withType: T.self) - for _ in 0 ..< N { - for _ in 0 ..< 5_000_000 { - if !existential.doIt() || !existential.reallyDoIt() { - fatalError("expected true") - } + for _ in 0 ..< N * 20_000 { + if !existential.doIt() || !existential.reallyDoIt() { + fatalError("expected true") } } } @@ -342,11 +338,9 @@ func runTestTwoMethodCalls(withType: T.Type, numberOfTimes N: In func runTestPassExistentialOneMethodCall(withType: T.Type, numberOfTimes N: Int) { let existential = initExistential(withType: T.self) let existential2 = initExistential(withType: T.self) - for _ in 0 ..< N { - for _ in 0 ..< 5_000_000 { - if !passExistentialTwiceOneMethodCall(existential, existential2) { - fatalError("expected true") - } + for _ in 0 ..< N * 20_000 { + if !passExistentialTwiceOneMethodCall(existential, existential2) { + fatalError("expected true") } } } @@ -354,46 +348,38 @@ func runTestPassExistentialOneMethodCall(withType: T.Type, numbe func runTestPassExistentialTwoMethodCalls(withType: T.Type, numberOfTimes N: Int) { let existential = initExistential(withType: T.self) let existential2 = initExistential(withType: T.self) - for _ in 0 ..< N { - for _ in 0 ..< 5_000_000 { - if !passExistentialTwiceTwoMethodCalls(existential, existential2) { - fatalError("expected true") - } + for _ in 0 ..< N * 20_000 { + if !passExistentialTwiceTwoMethodCalls(existential, existential2) { + fatalError("expected true") } } } func runTestMutating(withType: T.Type, numberOfTimes N: Int) { var existential = initExistential(withType: T.self) - for _ in 0 ..< N { - for _ in 0 ..< 5_000_000 { - if !existential.mutateIt() { - fatalError("expected true") - } + for _ in 0 ..< N * 10_000 { + if !existential.mutateIt() { + fatalError("expected true") } } } func runTestMutatingAndNonMutating(withType: T.Type, numberOfTimes N: Int) { var existential = initExistential(withType: T.self) - for _ in 0 ..< N { - for _ in 0 ..< 5_000_000 { - let _ = existential.doIt() - if !existential.mutateIt() { - fatalError("expected true") - } + for _ in 0 ..< N * 10_000 { + let _ = existential.doIt() + if !existential.mutateIt() { + fatalError("expected true") } } } func runTestArrayOneMethodCall(withType: T.Type, numberOfTimes N: Int) { let existentialArray = initExistentialArray(withType: T.self, count: 128) - for _ in 0 ..< N { - for _ in 0 ..< 5_000 { - for elt in existentialArray { - if !elt.doIt() { - fatalError("expected true") - } + for _ in 0 ..< N * 100 { + for elt in existentialArray { + if !elt.doIt() { + fatalError("expected true") } } } @@ -401,12 +387,10 @@ func runTestArrayOneMethodCall(withType: T.Type, numberOfTimes N func runTestArrayTwoMethodCalls(withType: T.Type, numberOfTimes N: Int) { let existentialArray = initExistentialArray(withType: T.self, count: 128) - for _ in 0 ..< N { - for _ in 0 ..< 5_000 { - for elt in existentialArray { - if !elt.doIt() || !elt.reallyDoIt() { - fatalError("expected true") - } + for _ in 0 ..< N * 100 { + for elt in existentialArray { + if !elt.doIt() || !elt.reallyDoIt() { + fatalError("expected true") } } } @@ -414,12 +398,10 @@ func runTestArrayTwoMethodCalls(withType: T.Type, numberOfTimes func runTestArrayMutating(withType: T.Type, numberOfTimes N: Int) { var existentialArray = initExistentialArray(withType: T.self, count: 128) - for _ in 0 ..< N { - for _ in 0 ..< 5_000 { - for i in 0 ..< existentialArray.count { - if !existentialArray[i].mutateIt() { - fatalError("expected true") - } + for _ in 0 ..< N * 100 { + for i in 0 ..< existentialArray.count { + if !existentialArray[i].mutateIt() { + fatalError("expected true") } } } @@ -427,24 +409,20 @@ func runTestArrayMutating(withType: T.Type, numberOfTimes N: Int func runTestArrayShift(withType: T.Type, numberOfTimes N: Int) { var existentialArray = initExistentialArray(withType: T.self, count: 128) - for _ in 0 ..< N { - for _ in 0 ..< 5_000 { - for i in 0 ..< existentialArray.count-1 { - existentialArray.swapAt(i, i+1) - } + for _ in 0 ..< N * 10 { + for i in 0 ..< existentialArray.count-1 { + existentialArray.swapAt(i, i+1) } } } func runTestArrayConditionalShift(withType: T.Type, numberOfTimes N: Int) { var existentialArray = initExistentialArray(withType: T.self, count: 128) - for _ in 0 ..< N { - for _ in 0 ..< 5_000 { - for i in 0 ..< existentialArray.count-1 { - let curr = existentialArray[i] - if curr.doIt() { - existentialArray[i] = existentialArray[i+1] - existentialArray[i+1] = curr - } + for _ in 0 ..< N * 10 { + for i in 0 ..< existentialArray.count-1 { + let curr = existentialArray[i] + if curr.doIt() { + existentialArray[i] = existentialArray[i+1] + existentialArray[i+1] = curr } } } From 1bd702a24cf0e457a15c88681fc55e786464f8ce Mon Sep 17 00:00:00 2001 From: Pavol Vaskovic Date: Wed, 14 Nov 2018 16:30:40 +0100 Subject: [PATCH 03/12] [benchmark] GYB ExistentialPerformance Painstakingly reverse-engineered the boilerplate generator, that produces ExistentialPerformance.swift (sans few whitespace differences), to ease maintanance (The upcoming refactoring). --- .../ExistentialPerformance.swift | 26 +- .../ExistentialPerformance.swift.gyb | 242 ++++++++++++++++++ 2 files changed, 259 insertions(+), 9 deletions(-) create mode 100644 benchmark/single-source/ExistentialPerformance.swift.gyb diff --git a/benchmark/single-source/ExistentialPerformance.swift b/benchmark/single-source/ExistentialPerformance.swift index 486ce864a30ab..3583a10c217c5 100644 --- a/benchmark/single-source/ExistentialPerformance.swift +++ b/benchmark/single-source/ExistentialPerformance.swift @@ -1,4 +1,4 @@ -//===----------------------------------------------------------------------===// +//===--- ExistentialPerformance.swift -------------------------*- swift -*-===// // // This source file is part of the Swift.org open source project // @@ -10,6 +10,12 @@ // //===----------------------------------------------------------------------===// +//////////////////////////////////////////////////////////////////////////////// +// WARNING: This file is manually generated from .gyb template and should not +// be directly modified. Instead, change ExistentialPerformance.swift.gyb +// and run scripts/generate_harness/generate_harness.py to regenerate this file. +//////////////////////////////////////////////////////////////////////////////// + import TestsUtils public let ExistentialPerformance = [ @@ -144,10 +150,10 @@ struct IntValueBuffer1 : Existential { return f0 == 0 } func reallyDoIt() -> Bool { - return true + return true } mutating func mutateIt() -> Bool { - next(&f0, upto: 1) + next(&f0, upto: 1) return true } } @@ -180,8 +186,7 @@ struct IntValueBuffer3 : Existential { func reallyDoIt() -> Bool { return f0 == 0 && f1 == 3 && f2 == 7 } - - mutating func mutateIt() -> Bool{ + mutating func mutateIt() -> Bool { next(&f0, upto: 1) next(&f1, upto: 3) next(&f2, upto: 7) @@ -201,8 +206,7 @@ struct IntValueBuffer4 : Existential { func reallyDoIt() -> Bool { return f0 == 0 && f1 == 3 && f2 == 7 && f3 == 13 } - - mutating func mutateIt() -> Bool{ + mutating func mutateIt() -> Bool { next(&f0, upto: 1) next(&f1, upto: 3) next(&f2, upto: 7) @@ -281,12 +285,11 @@ struct ClassValueBuffer4 : Existential { var f0: Klazz = Klazz() var f1: Klazz = Klazz() var f2: Klazz = Klazz() - var f3: Int = 0 + var f3: Int = 0 func doIt() -> Bool { return f0.doIt() } - func reallyDoIt() -> Bool { return f0.reallyDoIt() } @@ -415,6 +418,7 @@ func runTestArrayShift(withType: T.Type, numberOfTimes N: Int) { } } } + func runTestArrayConditionalShift(withType: T.Type, numberOfTimes N: Int) { var existentialArray = initExistentialArray(withType: T.self, count: 128) for _ in 0 ..< N * 10 { @@ -746,3 +750,7 @@ public func run_ExistentialTestArrayConditionalShift_ClassValueBuffer3(_ N: Int) public func run_ExistentialTestArrayConditionalShift_ClassValueBuffer4(_ N: Int) { runTestArrayConditionalShift(withType: ClassValueBuffer4.self, numberOfTimes: N) } + +// Local Variables: +// eval: (read-only-mode 1) +// End: diff --git a/benchmark/single-source/ExistentialPerformance.swift.gyb b/benchmark/single-source/ExistentialPerformance.swift.gyb new file mode 100644 index 0000000000000..1d623d7b8cbbc --- /dev/null +++ b/benchmark/single-source/ExistentialPerformance.swift.gyb @@ -0,0 +1,242 @@ +//===--- ExistentialPerformance.swift -------------------------*- swift -*-===// +// +// This source file is part of the Swift.org open source project +// +// Copyright (c) 2014 - 2017 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 +// +//===----------------------------------------------------------------------===// + +% # Ignore the following warning. This _is_ the correct file to edit. +//////////////////////////////////////////////////////////////////////////////// +// WARNING: This file is manually generated from .gyb template and should not +// be directly modified. Instead, change ExistentialPerformance.swift.gyb +// and run scripts/generate_harness/generate_harness.py to regenerate this file. +//////////////////////////////////////////////////////////////////////////////// + +import TestsUtils + +%{ +FN = 'ExistentialTest' +Groups = ( + ['Array' + g for g in ['ConditionalShift', 'Mutating', 'OneMethodCall', + 'Shift', 'TwoMethodCalls']] + + ['MutatingAndNonMutating', 'Mutating', 'OneMethodCall', + 'PassExistentialOneMethodCall', 'PassExistentialTwoMethodCalls', + 'TwoMethodCalls'] +) +Vars = [(0, 0), (1, 3), (2, 7), (3, 13)] +Refs = ['ClassValueBuffer' + str(i) for i in range(1, 5)] +Vals = ['IntValueBuffer' + str(i) for i in range(0, 5)] +Variants = Refs + Vals +Names = [FN + group + '_' + variant for group in Groups for variant in Variants] + +Setup = """ + let existentialArray = initExistentialArray(withType: T.self, count: 128) + let existential = initExistential(withType: T.self) + let existential2 = initExistential(withType: T.self) + var existential = initExistential(withType: T.self) + var existentialArray = initExistentialArray(withType: T.self, count: 128) +""".splitlines()[1:] +Setup = [Setup[0], Setup[1], '\n'.join(Setup[1:3]), Setup[3], Setup[4]] + +Workloads = [ + ('OneMethodCall', Setup[1], '20_000', """ + if !existential.doIt() { + fatalError("expected true") + } +"""), + ('TwoMethodCalls', Setup[1], '20_000', """ + if !existential.doIt() || !existential.reallyDoIt() { + fatalError("expected true") + } +"""), + ('PassExistentialOneMethodCall', Setup[2], '20_000', """ + if !passExistentialTwiceOneMethodCall(existential, existential2) { + fatalError("expected true") + } +"""), + ('PassExistentialTwoMethodCalls', Setup[2], '20_000', """ + if !passExistentialTwiceTwoMethodCalls(existential, existential2) { + fatalError("expected true") + } +"""), + ('Mutating', Setup[3], '10_000', """ + if !existential.mutateIt() { + fatalError("expected true") + } +"""), + ('MutatingAndNonMutating', Setup[3], '10_000', """ + let _ = existential.doIt() + if !existential.mutateIt() { + fatalError("expected true") + } +"""), + ('ArrayOneMethodCall', Setup[0], '100', """ + for elt in existentialArray { + if !elt.doIt() { + fatalError("expected true") + } + } +"""), + ('ArrayTwoMethodCalls', Setup[0], '100', """ + for elt in existentialArray { + if !elt.doIt() || !elt.reallyDoIt() { + fatalError("expected true") + } + } +"""), + ('ArrayMutating', Setup[4], '100', """ + for i in 0 ..< existentialArray.count { + if !existentialArray[i].mutateIt() { + fatalError("expected true") + } + } +"""), + ('ArrayShift', Setup[4], '10', """ + for i in 0 ..< existentialArray.count-1 { + existentialArray.swapAt(i, i+1) + } +"""), + ('ArrayConditionalShift', Setup[4], '10', """ + for i in 0 ..< existentialArray.count-1 { + let curr = existentialArray[i] + if curr.doIt() { + existentialArray[i] = existentialArray[i+1] + existentialArray[i+1] = curr + } + } +"""), +] +}% +public let ExistentialPerformance = [ +% for Name in Names: + BenchmarkInfo(name: "${Name}", runFunction: run_${Name}, tags: [.unstable${ + ', .api, .Array' if 'Array' in Name else ''}]), +% end +] + +protocol Existential { + init() + func doIt() -> Bool + func reallyDoIt() -> Bool + mutating func mutateIt() -> Bool +} + +struct IntValueBuffer0 : Existential { + func doIt() -> Bool { + return true + } + func reallyDoIt() -> Bool { + return true + } + mutating func mutateIt() -> Bool { + return true + } +} + +func next(_ x: inout Int, upto mod: Int) { + x = (x + 1) % (mod + 1) +} + +% for (V, i) in [(v, int(filter(str.isdigit, v))) for v in Vals[1:]]: +struct ${V} : Existential { + ${'\n '.join(['var f{0}: Int = {1}'.format(vi, v) + for (vi, v) in Vars[0:i]])} + + func doIt() -> Bool { + return f0 == 0 + } + func reallyDoIt() -> Bool { + return ${ + 'true' if i == 1 else + ' && '.join(['f{0} == {1}'.format(vi, v) for (vi, v) in Vars[0:i]])} + } + mutating func mutateIt() -> Bool { + ${ + '\n '.join(['next(&f{0}, upto: {1})'.format(vi, (v if v > 0 else 1)) + for (vi, v) in Vars[0:i]])} + return true + } +} + +% end +class Klazz { + var f0: Int = 0 + var f1: Int = 3 + + func doIt() -> Bool { + return f0 == 0 + } + func reallyDoIt() -> Bool { + return f0 == 0 && f1 == 3 + } + + func mutateIt() -> Bool{ + next(&f0, upto: 1) + next(&f1, upto: 3) + return true + } +} + +% for (V, i) in [(v, int(filter(str.isdigit, v))) for v in Refs]: +struct ${V} : Existential { + ${'\n '.join([('var f{0}: Klazz = Klazz()'.format(vi) if vi < 3 else + 'var f3: Int = 0') for (vi, _) in Vars[0:i]])} + + func doIt() -> Bool { + return f0.doIt() + } + func reallyDoIt() -> Bool { + return f0.reallyDoIt() + } + + mutating func mutateIt() -> Bool{ + return f0.mutateIt() + } +} + +% end + +@inline(never) +func initExistential(withType: T.Type) -> Existential { + return T() +} + +@inline(never) +func initExistentialArray(withType: T.Type, count c: Int) -> [Existential] { + return [T](repeating: T(), count: c) +} + +@inline(never) +func passExistentialTwiceOneMethodCall(_ e0: Existential, _ e1: Existential) -> Bool { + return e0.doIt() && e1.doIt() +} + +@inline(never) +func passExistentialTwiceTwoMethodCalls(_ e0: Existential, _ e1: Existential) -> Bool { + return e0.doIt() && e1.doIt() && e0.reallyDoIt() && e1.reallyDoIt() +} +% for (name, setup, multiple, workload) in Workloads: +${""" +func runTest{0}(withType: T.Type, numberOfTimes N: Int) {{ +{1} + for _ in 0 ..< N * {2} {{{3} }} +}}""".format(name, setup, multiple, workload)} +% end + +% for (Name, _, _, _) in Workloads: +// Test${Name}. +% for Variant in Vals + Refs: +public func run_ExistentialTest${Name}_${Variant}(_ N: Int) { + runTest${Name}(withType: ${Variant}.self, numberOfTimes: N) +} +% end + +% end +// ${'Local Variables'}: +// eval: (read-only-mode 1) +// End: From 5bbb9ff5098b6bb3f9bcbeee9ac17f41fb3c5383 Mon Sep 17 00:00:00 2001 From: Pavol Vaskovic Date: Thu, 15 Nov 2018 12:10:28 +0100 Subject: [PATCH 04/12] [benchmark] Gardening: BenchmarkInfo order Sanity refactoring: * Generate `BenchmarkInfo` in the same order as run loops. * Generate `IntValueBuffer0`, too. * Minor code formatting tweeks. --- .../ExistentialPerformance.swift | 167 +++++++++--------- .../ExistentialPerformance.swift.gyb | 61 ++----- 2 files changed, 100 insertions(+), 128 deletions(-) diff --git a/benchmark/single-source/ExistentialPerformance.swift b/benchmark/single-source/ExistentialPerformance.swift index 3583a10c217c5..6ac840c943705 100644 --- a/benchmark/single-source/ExistentialPerformance.swift +++ b/benchmark/single-source/ExistentialPerformance.swift @@ -19,69 +19,6 @@ import TestsUtils public let ExistentialPerformance = [ - BenchmarkInfo(name: "ExistentialTestArrayConditionalShift_ClassValueBuffer1", runFunction: run_ExistentialTestArrayConditionalShift_ClassValueBuffer1, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayConditionalShift_ClassValueBuffer2", runFunction: run_ExistentialTestArrayConditionalShift_ClassValueBuffer2, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayConditionalShift_ClassValueBuffer3", runFunction: run_ExistentialTestArrayConditionalShift_ClassValueBuffer3, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayConditionalShift_ClassValueBuffer4", runFunction: run_ExistentialTestArrayConditionalShift_ClassValueBuffer4, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayConditionalShift_IntValueBuffer0", runFunction: run_ExistentialTestArrayConditionalShift_IntValueBuffer0, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayConditionalShift_IntValueBuffer1", runFunction: run_ExistentialTestArrayConditionalShift_IntValueBuffer1, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayConditionalShift_IntValueBuffer2", runFunction: run_ExistentialTestArrayConditionalShift_IntValueBuffer2, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayConditionalShift_IntValueBuffer3", runFunction: run_ExistentialTestArrayConditionalShift_IntValueBuffer3, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayConditionalShift_IntValueBuffer4", runFunction: run_ExistentialTestArrayConditionalShift_IntValueBuffer4, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayMutating_ClassValueBuffer1", runFunction: run_ExistentialTestArrayMutating_ClassValueBuffer1, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayMutating_ClassValueBuffer2", runFunction: run_ExistentialTestArrayMutating_ClassValueBuffer2, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayMutating_ClassValueBuffer3", runFunction: run_ExistentialTestArrayMutating_ClassValueBuffer3, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayMutating_ClassValueBuffer4", runFunction: run_ExistentialTestArrayMutating_ClassValueBuffer4, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayMutating_IntValueBuffer0", runFunction: run_ExistentialTestArrayMutating_IntValueBuffer0, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayMutating_IntValueBuffer1", runFunction: run_ExistentialTestArrayMutating_IntValueBuffer1, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayMutating_IntValueBuffer2", runFunction: run_ExistentialTestArrayMutating_IntValueBuffer2, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayMutating_IntValueBuffer3", runFunction: run_ExistentialTestArrayMutating_IntValueBuffer3, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayMutating_IntValueBuffer4", runFunction: run_ExistentialTestArrayMutating_IntValueBuffer4, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayOneMethodCall_ClassValueBuffer1", runFunction: run_ExistentialTestArrayOneMethodCall_ClassValueBuffer1, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayOneMethodCall_ClassValueBuffer2", runFunction: run_ExistentialTestArrayOneMethodCall_ClassValueBuffer2, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayOneMethodCall_ClassValueBuffer3", runFunction: run_ExistentialTestArrayOneMethodCall_ClassValueBuffer3, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayOneMethodCall_ClassValueBuffer4", runFunction: run_ExistentialTestArrayOneMethodCall_ClassValueBuffer4, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayOneMethodCall_IntValueBuffer0", runFunction: run_ExistentialTestArrayOneMethodCall_IntValueBuffer0, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayOneMethodCall_IntValueBuffer1", runFunction: run_ExistentialTestArrayOneMethodCall_IntValueBuffer1, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayOneMethodCall_IntValueBuffer2", runFunction: run_ExistentialTestArrayOneMethodCall_IntValueBuffer2, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayOneMethodCall_IntValueBuffer3", runFunction: run_ExistentialTestArrayOneMethodCall_IntValueBuffer3, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayOneMethodCall_IntValueBuffer4", runFunction: run_ExistentialTestArrayOneMethodCall_IntValueBuffer4, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayShift_ClassValueBuffer1", runFunction: run_ExistentialTestArrayShift_ClassValueBuffer1, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayShift_ClassValueBuffer2", runFunction: run_ExistentialTestArrayShift_ClassValueBuffer2, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayShift_ClassValueBuffer3", runFunction: run_ExistentialTestArrayShift_ClassValueBuffer3, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayShift_ClassValueBuffer4", runFunction: run_ExistentialTestArrayShift_ClassValueBuffer4, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayShift_IntValueBuffer0", runFunction: run_ExistentialTestArrayShift_IntValueBuffer0, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayShift_IntValueBuffer1", runFunction: run_ExistentialTestArrayShift_IntValueBuffer1, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayShift_IntValueBuffer2", runFunction: run_ExistentialTestArrayShift_IntValueBuffer2, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayShift_IntValueBuffer3", runFunction: run_ExistentialTestArrayShift_IntValueBuffer3, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayShift_IntValueBuffer4", runFunction: run_ExistentialTestArrayShift_IntValueBuffer4, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayTwoMethodCalls_ClassValueBuffer1", runFunction: run_ExistentialTestArrayTwoMethodCalls_ClassValueBuffer1, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayTwoMethodCalls_ClassValueBuffer2", runFunction: run_ExistentialTestArrayTwoMethodCalls_ClassValueBuffer2, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayTwoMethodCalls_ClassValueBuffer3", runFunction: run_ExistentialTestArrayTwoMethodCalls_ClassValueBuffer3, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayTwoMethodCalls_ClassValueBuffer4", runFunction: run_ExistentialTestArrayTwoMethodCalls_ClassValueBuffer4, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayTwoMethodCalls_IntValueBuffer0", runFunction: run_ExistentialTestArrayTwoMethodCalls_IntValueBuffer0, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayTwoMethodCalls_IntValueBuffer1", runFunction: run_ExistentialTestArrayTwoMethodCalls_IntValueBuffer1, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayTwoMethodCalls_IntValueBuffer2", runFunction: run_ExistentialTestArrayTwoMethodCalls_IntValueBuffer2, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayTwoMethodCalls_IntValueBuffer3", runFunction: run_ExistentialTestArrayTwoMethodCalls_IntValueBuffer3, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayTwoMethodCalls_IntValueBuffer4", runFunction: run_ExistentialTestArrayTwoMethodCalls_IntValueBuffer4, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestMutatingAndNonMutating_ClassValueBuffer1", runFunction: run_ExistentialTestMutatingAndNonMutating_ClassValueBuffer1, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestMutatingAndNonMutating_ClassValueBuffer2", runFunction: run_ExistentialTestMutatingAndNonMutating_ClassValueBuffer2, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestMutatingAndNonMutating_ClassValueBuffer3", runFunction: run_ExistentialTestMutatingAndNonMutating_ClassValueBuffer3, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestMutatingAndNonMutating_ClassValueBuffer4", runFunction: run_ExistentialTestMutatingAndNonMutating_ClassValueBuffer4, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestMutatingAndNonMutating_IntValueBuffer0", runFunction: run_ExistentialTestMutatingAndNonMutating_IntValueBuffer0, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestMutatingAndNonMutating_IntValueBuffer1", runFunction: run_ExistentialTestMutatingAndNonMutating_IntValueBuffer1, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestMutatingAndNonMutating_IntValueBuffer2", runFunction: run_ExistentialTestMutatingAndNonMutating_IntValueBuffer2, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestMutatingAndNonMutating_IntValueBuffer3", runFunction: run_ExistentialTestMutatingAndNonMutating_IntValueBuffer3, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestMutatingAndNonMutating_IntValueBuffer4", runFunction: run_ExistentialTestMutatingAndNonMutating_IntValueBuffer4, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestMutating_ClassValueBuffer1", runFunction: run_ExistentialTestMutating_ClassValueBuffer1, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestMutating_ClassValueBuffer2", runFunction: run_ExistentialTestMutating_ClassValueBuffer2, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestMutating_ClassValueBuffer3", runFunction: run_ExistentialTestMutating_ClassValueBuffer3, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestMutating_ClassValueBuffer4", runFunction: run_ExistentialTestMutating_ClassValueBuffer4, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestMutating_IntValueBuffer0", runFunction: run_ExistentialTestMutating_IntValueBuffer0, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestMutating_IntValueBuffer1", runFunction: run_ExistentialTestMutating_IntValueBuffer1, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestMutating_IntValueBuffer2", runFunction: run_ExistentialTestMutating_IntValueBuffer2, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestMutating_IntValueBuffer3", runFunction: run_ExistentialTestMutating_IntValueBuffer3, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestMutating_IntValueBuffer4", runFunction: run_ExistentialTestMutating_IntValueBuffer4, tags: [.unstable]), BenchmarkInfo(name: "ExistentialTestOneMethodCall_ClassValueBuffer1", runFunction: run_ExistentialTestOneMethodCall_ClassValueBuffer1, tags: [.unstable]), BenchmarkInfo(name: "ExistentialTestOneMethodCall_ClassValueBuffer2", runFunction: run_ExistentialTestOneMethodCall_ClassValueBuffer2, tags: [.unstable]), BenchmarkInfo(name: "ExistentialTestOneMethodCall_ClassValueBuffer3", runFunction: run_ExistentialTestOneMethodCall_ClassValueBuffer3, tags: [.unstable]), @@ -91,6 +28,15 @@ public let ExistentialPerformance = [ BenchmarkInfo(name: "ExistentialTestOneMethodCall_IntValueBuffer2", runFunction: run_ExistentialTestOneMethodCall_IntValueBuffer2, tags: [.unstable]), BenchmarkInfo(name: "ExistentialTestOneMethodCall_IntValueBuffer3", runFunction: run_ExistentialTestOneMethodCall_IntValueBuffer3, tags: [.unstable]), BenchmarkInfo(name: "ExistentialTestOneMethodCall_IntValueBuffer4", runFunction: run_ExistentialTestOneMethodCall_IntValueBuffer4, tags: [.unstable]), + BenchmarkInfo(name: "ExistentialTestTwoMethodCalls_ClassValueBuffer1", runFunction: run_ExistentialTestTwoMethodCalls_ClassValueBuffer1, tags: [.unstable]), + BenchmarkInfo(name: "ExistentialTestTwoMethodCalls_ClassValueBuffer2", runFunction: run_ExistentialTestTwoMethodCalls_ClassValueBuffer2, tags: [.unstable]), + BenchmarkInfo(name: "ExistentialTestTwoMethodCalls_ClassValueBuffer3", runFunction: run_ExistentialTestTwoMethodCalls_ClassValueBuffer3, tags: [.unstable]), + BenchmarkInfo(name: "ExistentialTestTwoMethodCalls_ClassValueBuffer4", runFunction: run_ExistentialTestTwoMethodCalls_ClassValueBuffer4, tags: [.unstable]), + BenchmarkInfo(name: "ExistentialTestTwoMethodCalls_IntValueBuffer0", runFunction: run_ExistentialTestTwoMethodCalls_IntValueBuffer0, tags: [.unstable]), + BenchmarkInfo(name: "ExistentialTestTwoMethodCalls_IntValueBuffer1", runFunction: run_ExistentialTestTwoMethodCalls_IntValueBuffer1, tags: [.unstable]), + BenchmarkInfo(name: "ExistentialTestTwoMethodCalls_IntValueBuffer2", runFunction: run_ExistentialTestTwoMethodCalls_IntValueBuffer2, tags: [.unstable]), + BenchmarkInfo(name: "ExistentialTestTwoMethodCalls_IntValueBuffer3", runFunction: run_ExistentialTestTwoMethodCalls_IntValueBuffer3, tags: [.unstable]), + BenchmarkInfo(name: "ExistentialTestTwoMethodCalls_IntValueBuffer4", runFunction: run_ExistentialTestTwoMethodCalls_IntValueBuffer4, tags: [.unstable]), BenchmarkInfo(name: "ExistentialTestPassExistentialOneMethodCall_ClassValueBuffer1", runFunction: run_ExistentialTestPassExistentialOneMethodCall_ClassValueBuffer1, tags: [.unstable]), BenchmarkInfo(name: "ExistentialTestPassExistentialOneMethodCall_ClassValueBuffer2", runFunction: run_ExistentialTestPassExistentialOneMethodCall_ClassValueBuffer2, tags: [.unstable]), BenchmarkInfo(name: "ExistentialTestPassExistentialOneMethodCall_ClassValueBuffer3", runFunction: run_ExistentialTestPassExistentialOneMethodCall_ClassValueBuffer3, tags: [.unstable]), @@ -109,15 +55,69 @@ public let ExistentialPerformance = [ BenchmarkInfo(name: "ExistentialTestPassExistentialTwoMethodCalls_IntValueBuffer2", runFunction: run_ExistentialTestPassExistentialTwoMethodCalls_IntValueBuffer2, tags: [.unstable]), BenchmarkInfo(name: "ExistentialTestPassExistentialTwoMethodCalls_IntValueBuffer3", runFunction: run_ExistentialTestPassExistentialTwoMethodCalls_IntValueBuffer3, tags: [.unstable]), BenchmarkInfo(name: "ExistentialTestPassExistentialTwoMethodCalls_IntValueBuffer4", runFunction: run_ExistentialTestPassExistentialTwoMethodCalls_IntValueBuffer4, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestTwoMethodCalls_ClassValueBuffer1", runFunction: run_ExistentialTestTwoMethodCalls_ClassValueBuffer1, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestTwoMethodCalls_ClassValueBuffer2", runFunction: run_ExistentialTestTwoMethodCalls_ClassValueBuffer2, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestTwoMethodCalls_ClassValueBuffer3", runFunction: run_ExistentialTestTwoMethodCalls_ClassValueBuffer3, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestTwoMethodCalls_ClassValueBuffer4", runFunction: run_ExistentialTestTwoMethodCalls_ClassValueBuffer4, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestTwoMethodCalls_IntValueBuffer0", runFunction: run_ExistentialTestTwoMethodCalls_IntValueBuffer0, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestTwoMethodCalls_IntValueBuffer1", runFunction: run_ExistentialTestTwoMethodCalls_IntValueBuffer1, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestTwoMethodCalls_IntValueBuffer2", runFunction: run_ExistentialTestTwoMethodCalls_IntValueBuffer2, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestTwoMethodCalls_IntValueBuffer3", runFunction: run_ExistentialTestTwoMethodCalls_IntValueBuffer3, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestTwoMethodCalls_IntValueBuffer4", runFunction: run_ExistentialTestTwoMethodCalls_IntValueBuffer4, tags: [.unstable]), + BenchmarkInfo(name: "ExistentialTestMutating_ClassValueBuffer1", runFunction: run_ExistentialTestMutating_ClassValueBuffer1, tags: [.unstable]), + BenchmarkInfo(name: "ExistentialTestMutating_ClassValueBuffer2", runFunction: run_ExistentialTestMutating_ClassValueBuffer2, tags: [.unstable]), + BenchmarkInfo(name: "ExistentialTestMutating_ClassValueBuffer3", runFunction: run_ExistentialTestMutating_ClassValueBuffer3, tags: [.unstable]), + BenchmarkInfo(name: "ExistentialTestMutating_ClassValueBuffer4", runFunction: run_ExistentialTestMutating_ClassValueBuffer4, tags: [.unstable]), + BenchmarkInfo(name: "ExistentialTestMutating_IntValueBuffer0", runFunction: run_ExistentialTestMutating_IntValueBuffer0, tags: [.unstable]), + BenchmarkInfo(name: "ExistentialTestMutating_IntValueBuffer1", runFunction: run_ExistentialTestMutating_IntValueBuffer1, tags: [.unstable]), + BenchmarkInfo(name: "ExistentialTestMutating_IntValueBuffer2", runFunction: run_ExistentialTestMutating_IntValueBuffer2, tags: [.unstable]), + BenchmarkInfo(name: "ExistentialTestMutating_IntValueBuffer3", runFunction: run_ExistentialTestMutating_IntValueBuffer3, tags: [.unstable]), + BenchmarkInfo(name: "ExistentialTestMutating_IntValueBuffer4", runFunction: run_ExistentialTestMutating_IntValueBuffer4, tags: [.unstable]), + BenchmarkInfo(name: "ExistentialTestMutatingAndNonMutating_ClassValueBuffer1", runFunction: run_ExistentialTestMutatingAndNonMutating_ClassValueBuffer1, tags: [.unstable]), + BenchmarkInfo(name: "ExistentialTestMutatingAndNonMutating_ClassValueBuffer2", runFunction: run_ExistentialTestMutatingAndNonMutating_ClassValueBuffer2, tags: [.unstable]), + BenchmarkInfo(name: "ExistentialTestMutatingAndNonMutating_ClassValueBuffer3", runFunction: run_ExistentialTestMutatingAndNonMutating_ClassValueBuffer3, tags: [.unstable]), + BenchmarkInfo(name: "ExistentialTestMutatingAndNonMutating_ClassValueBuffer4", runFunction: run_ExistentialTestMutatingAndNonMutating_ClassValueBuffer4, tags: [.unstable]), + BenchmarkInfo(name: "ExistentialTestMutatingAndNonMutating_IntValueBuffer0", runFunction: run_ExistentialTestMutatingAndNonMutating_IntValueBuffer0, tags: [.unstable]), + BenchmarkInfo(name: "ExistentialTestMutatingAndNonMutating_IntValueBuffer1", runFunction: run_ExistentialTestMutatingAndNonMutating_IntValueBuffer1, tags: [.unstable]), + BenchmarkInfo(name: "ExistentialTestMutatingAndNonMutating_IntValueBuffer2", runFunction: run_ExistentialTestMutatingAndNonMutating_IntValueBuffer2, tags: [.unstable]), + BenchmarkInfo(name: "ExistentialTestMutatingAndNonMutating_IntValueBuffer3", runFunction: run_ExistentialTestMutatingAndNonMutating_IntValueBuffer3, tags: [.unstable]), + BenchmarkInfo(name: "ExistentialTestMutatingAndNonMutating_IntValueBuffer4", runFunction: run_ExistentialTestMutatingAndNonMutating_IntValueBuffer4, tags: [.unstable]), + BenchmarkInfo(name: "ExistentialTestArrayOneMethodCall_ClassValueBuffer1", runFunction: run_ExistentialTestArrayOneMethodCall_ClassValueBuffer1, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayOneMethodCall_ClassValueBuffer2", runFunction: run_ExistentialTestArrayOneMethodCall_ClassValueBuffer2, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayOneMethodCall_ClassValueBuffer3", runFunction: run_ExistentialTestArrayOneMethodCall_ClassValueBuffer3, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayOneMethodCall_ClassValueBuffer4", runFunction: run_ExistentialTestArrayOneMethodCall_ClassValueBuffer4, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayOneMethodCall_IntValueBuffer0", runFunction: run_ExistentialTestArrayOneMethodCall_IntValueBuffer0, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayOneMethodCall_IntValueBuffer1", runFunction: run_ExistentialTestArrayOneMethodCall_IntValueBuffer1, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayOneMethodCall_IntValueBuffer2", runFunction: run_ExistentialTestArrayOneMethodCall_IntValueBuffer2, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayOneMethodCall_IntValueBuffer3", runFunction: run_ExistentialTestArrayOneMethodCall_IntValueBuffer3, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayOneMethodCall_IntValueBuffer4", runFunction: run_ExistentialTestArrayOneMethodCall_IntValueBuffer4, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayTwoMethodCalls_ClassValueBuffer1", runFunction: run_ExistentialTestArrayTwoMethodCalls_ClassValueBuffer1, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayTwoMethodCalls_ClassValueBuffer2", runFunction: run_ExistentialTestArrayTwoMethodCalls_ClassValueBuffer2, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayTwoMethodCalls_ClassValueBuffer3", runFunction: run_ExistentialTestArrayTwoMethodCalls_ClassValueBuffer3, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayTwoMethodCalls_ClassValueBuffer4", runFunction: run_ExistentialTestArrayTwoMethodCalls_ClassValueBuffer4, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayTwoMethodCalls_IntValueBuffer0", runFunction: run_ExistentialTestArrayTwoMethodCalls_IntValueBuffer0, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayTwoMethodCalls_IntValueBuffer1", runFunction: run_ExistentialTestArrayTwoMethodCalls_IntValueBuffer1, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayTwoMethodCalls_IntValueBuffer2", runFunction: run_ExistentialTestArrayTwoMethodCalls_IntValueBuffer2, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayTwoMethodCalls_IntValueBuffer3", runFunction: run_ExistentialTestArrayTwoMethodCalls_IntValueBuffer3, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayTwoMethodCalls_IntValueBuffer4", runFunction: run_ExistentialTestArrayTwoMethodCalls_IntValueBuffer4, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayMutating_ClassValueBuffer1", runFunction: run_ExistentialTestArrayMutating_ClassValueBuffer1, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayMutating_ClassValueBuffer2", runFunction: run_ExistentialTestArrayMutating_ClassValueBuffer2, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayMutating_ClassValueBuffer3", runFunction: run_ExistentialTestArrayMutating_ClassValueBuffer3, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayMutating_ClassValueBuffer4", runFunction: run_ExistentialTestArrayMutating_ClassValueBuffer4, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayMutating_IntValueBuffer0", runFunction: run_ExistentialTestArrayMutating_IntValueBuffer0, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayMutating_IntValueBuffer1", runFunction: run_ExistentialTestArrayMutating_IntValueBuffer1, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayMutating_IntValueBuffer2", runFunction: run_ExistentialTestArrayMutating_IntValueBuffer2, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayMutating_IntValueBuffer3", runFunction: run_ExistentialTestArrayMutating_IntValueBuffer3, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayMutating_IntValueBuffer4", runFunction: run_ExistentialTestArrayMutating_IntValueBuffer4, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayShift_ClassValueBuffer1", runFunction: run_ExistentialTestArrayShift_ClassValueBuffer1, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayShift_ClassValueBuffer2", runFunction: run_ExistentialTestArrayShift_ClassValueBuffer2, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayShift_ClassValueBuffer3", runFunction: run_ExistentialTestArrayShift_ClassValueBuffer3, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayShift_ClassValueBuffer4", runFunction: run_ExistentialTestArrayShift_ClassValueBuffer4, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayShift_IntValueBuffer0", runFunction: run_ExistentialTestArrayShift_IntValueBuffer0, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayShift_IntValueBuffer1", runFunction: run_ExistentialTestArrayShift_IntValueBuffer1, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayShift_IntValueBuffer2", runFunction: run_ExistentialTestArrayShift_IntValueBuffer2, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayShift_IntValueBuffer3", runFunction: run_ExistentialTestArrayShift_IntValueBuffer3, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayShift_IntValueBuffer4", runFunction: run_ExistentialTestArrayShift_IntValueBuffer4, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayConditionalShift_ClassValueBuffer1", runFunction: run_ExistentialTestArrayConditionalShift_ClassValueBuffer1, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayConditionalShift_ClassValueBuffer2", runFunction: run_ExistentialTestArrayConditionalShift_ClassValueBuffer2, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayConditionalShift_ClassValueBuffer3", runFunction: run_ExistentialTestArrayConditionalShift_ClassValueBuffer3, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayConditionalShift_ClassValueBuffer4", runFunction: run_ExistentialTestArrayConditionalShift_ClassValueBuffer4, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayConditionalShift_IntValueBuffer0", runFunction: run_ExistentialTestArrayConditionalShift_IntValueBuffer0, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayConditionalShift_IntValueBuffer1", runFunction: run_ExistentialTestArrayConditionalShift_IntValueBuffer1, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayConditionalShift_IntValueBuffer2", runFunction: run_ExistentialTestArrayConditionalShift_IntValueBuffer2, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayConditionalShift_IntValueBuffer3", runFunction: run_ExistentialTestArrayConditionalShift_IntValueBuffer3, tags: [.unstable, .api, .Array]), + BenchmarkInfo(name: "ExistentialTestArrayConditionalShift_IntValueBuffer4", runFunction: run_ExistentialTestArrayConditionalShift_IntValueBuffer4, tags: [.unstable, .api, .Array]), ] protocol Existential { @@ -127,6 +127,10 @@ protocol Existential { mutating func mutateIt() -> Bool } +func next(_ x: inout Int, upto mod: Int) { + x = (x + 1) % (mod + 1) +} + struct IntValueBuffer0 : Existential { func doIt() -> Bool { return true @@ -139,10 +143,6 @@ struct IntValueBuffer0 : Existential { } } -func next(_ x: inout Int, upto mod: Int) { - x = (x + 1) % (mod + 1) -} - struct IntValueBuffer1 : Existential { var f0: Int = 0 @@ -150,7 +150,7 @@ struct IntValueBuffer1 : Existential { return f0 == 0 } func reallyDoIt() -> Bool { - return true + return true } mutating func mutateIt() -> Bool { next(&f0, upto: 1) @@ -166,7 +166,7 @@ struct IntValueBuffer2 : Existential { return f0 == 0 } func reallyDoIt() -> Bool { - return f0 == 0 && f1 == 3 + return f0 == 0 && f1 == 3 } mutating func mutateIt() -> Bool { next(&f0, upto: 1) @@ -184,7 +184,7 @@ struct IntValueBuffer3 : Existential { return f0 == 0 } func reallyDoIt() -> Bool { - return f0 == 0 && f1 == 3 && f2 == 7 + return f0 == 0 && f1 == 3 && f2 == 7 } mutating func mutateIt() -> Bool { next(&f0, upto: 1) @@ -204,7 +204,7 @@ struct IntValueBuffer4 : Existential { return f0 == 0 } func reallyDoIt() -> Bool { - return f0 == 0 && f1 == 3 && f2 == 7 && f3 == 13 + return f0 == 0 && f1 == 3 && f2 == 7 && f3 == 13 } mutating func mutateIt() -> Bool { next(&f0, upto: 1) @@ -215,7 +215,7 @@ struct IntValueBuffer4 : Existential { } } -class Klazz { +class Klazz { // body same as Val2 var f0: Int = 0 var f1: Int = 3 @@ -225,7 +225,6 @@ class Klazz { func reallyDoIt() -> Bool { return f0 == 0 && f1 == 3 } - func mutateIt() -> Bool{ next(&f0, upto: 1) next(&f1, upto: 3) @@ -242,7 +241,6 @@ struct ClassValueBuffer1 : Existential { func reallyDoIt() -> Bool { return f0.reallyDoIt() } - mutating func mutateIt() -> Bool{ return f0.mutateIt() } @@ -258,7 +256,6 @@ struct ClassValueBuffer2 : Existential { func reallyDoIt() -> Bool { return f0.reallyDoIt() } - mutating func mutateIt() -> Bool{ return f0.mutateIt() } @@ -275,7 +272,6 @@ struct ClassValueBuffer3 : Existential { func reallyDoIt() -> Bool { return f0.reallyDoIt() } - mutating func mutateIt() -> Bool{ return f0.mutateIt() } @@ -293,7 +289,6 @@ struct ClassValueBuffer4 : Existential { func reallyDoIt() -> Bool { return f0.reallyDoIt() } - mutating func mutateIt() -> Bool{ return f0.mutateIt() } diff --git a/benchmark/single-source/ExistentialPerformance.swift.gyb b/benchmark/single-source/ExistentialPerformance.swift.gyb index 1d623d7b8cbbc..933059528ccf3 100644 --- a/benchmark/single-source/ExistentialPerformance.swift.gyb +++ b/benchmark/single-source/ExistentialPerformance.swift.gyb @@ -20,20 +20,6 @@ import TestsUtils %{ -FN = 'ExistentialTest' -Groups = ( - ['Array' + g for g in ['ConditionalShift', 'Mutating', 'OneMethodCall', - 'Shift', 'TwoMethodCalls']] + - ['MutatingAndNonMutating', 'Mutating', 'OneMethodCall', - 'PassExistentialOneMethodCall', 'PassExistentialTwoMethodCalls', - 'TwoMethodCalls'] -) -Vars = [(0, 0), (1, 3), (2, 7), (3, 13)] -Refs = ['ClassValueBuffer' + str(i) for i in range(1, 5)] -Vals = ['IntValueBuffer' + str(i) for i in range(0, 5)] -Variants = Refs + Vals -Names = [FN + group + '_' + variant for group in Groups for variant in Variants] - Setup = """ let existentialArray = initExistentialArray(withType: T.self, count: 128) let existential = initExistential(withType: T.self) @@ -111,6 +97,11 @@ Workloads = [ } """), ] +Vars = [(0, 0), (1, 3), (2, 7), (3, 13)] +Refs = ['ClassValueBuffer' + str(i) for i in range(1, 5)] +Vals = ['IntValueBuffer' + str(i) for i in range(0, 5)] +Names = ['ExistentialTest' + group + '_' + variant + for (group, _, _, _) in Workloads for variant in Refs + Vals] }% public let ExistentialPerformance = [ % for Name in Names: @@ -126,45 +117,33 @@ protocol Existential { mutating func mutateIt() -> Bool } -struct IntValueBuffer0 : Existential { - func doIt() -> Bool { - return true - } - func reallyDoIt() -> Bool { - return true - } - mutating func mutateIt() -> Bool { - return true - } -} - func next(_ x: inout Int, upto mod: Int) { x = (x + 1) % (mod + 1) } -% for (V, i) in [(v, int(filter(str.isdigit, v))) for v in Vals[1:]]: -struct ${V} : Existential { - ${'\n '.join(['var f{0}: Int = {1}'.format(vi, v) - for (vi, v) in Vars[0:i]])} - +% for (V, i) in [(v, int(filter(str.isdigit, v))) for v in Vals]: +struct ${V} : Existential {${ + ''.join(['\n var f{0}: Int = {1}'.format(vi, v) + for (vi, v) in Vars[0:i]]) + + '\n' if i > 0 else ''} func doIt() -> Bool { - return f0 == 0 + return ${'f0 == 0' if i > 0 else 'true'} } func reallyDoIt() -> Bool { - return ${ - 'true' if i == 1 else - ' && '.join(['f{0} == {1}'.format(vi, v) for (vi, v) in Vars[0:i]])} + return ${ + 'true' if i == 1 else # so that Val1 doesn't do more work than Val2 + ' && '.join(['f{0} == {1}'.format(vi, v) for (vi, v) in Vars[0:i]]) or + 'true'} } - mutating func mutateIt() -> Bool { - ${ - '\n '.join(['next(&f{0}, upto: {1})'.format(vi, (v if v > 0 else 1)) - for (vi, v) in Vars[0:i]])} + mutating func mutateIt() -> Bool {${ + ''.join(['\n next(&f{0}, upto: {1})'.format(vi, (v if v > 0 else 1)) + for (vi, v) in Vars[0:i]])} return true } } % end -class Klazz { +class Klazz { // body same as Val2 var f0: Int = 0 var f1: Int = 3 @@ -174,7 +153,6 @@ class Klazz { func reallyDoIt() -> Bool { return f0 == 0 && f1 == 3 } - func mutateIt() -> Bool{ next(&f0, upto: 1) next(&f1, upto: 3) @@ -193,7 +171,6 @@ struct ${V} : Existential { func reallyDoIt() -> Bool { return f0.reallyDoIt() } - mutating func mutateIt() -> Bool{ return f0.mutateIt() } From 06cf0c898b65581920a59d04b391c8f3999de172 Mon Sep 17 00:00:00 2001 From: Pavol Vaskovic Date: Fri, 16 Nov 2018 21:01:37 +0100 Subject: [PATCH 05/12] [benchmark] Existential: shorter names Renamed tests according to the naming convention proposed in PR #20334. They now fit the 40 character limit and are structured into groups and variants. Also extracted tags into 2 constants, to simplify the [BenchmarkInfo] expression. --- .../ExistentialPerformance.swift | 660 +++++++++--------- .../ExistentialPerformance.swift.gyb | 55 +- 2 files changed, 366 insertions(+), 349 deletions(-) diff --git a/benchmark/single-source/ExistentialPerformance.swift b/benchmark/single-source/ExistentialPerformance.swift index 6ac840c943705..d44e8954f989f 100644 --- a/benchmark/single-source/ExistentialPerformance.swift +++ b/benchmark/single-source/ExistentialPerformance.swift @@ -18,106 +18,108 @@ import TestsUtils -public let ExistentialPerformance = [ - BenchmarkInfo(name: "ExistentialTestOneMethodCall_ClassValueBuffer1", runFunction: run_ExistentialTestOneMethodCall_ClassValueBuffer1, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestOneMethodCall_ClassValueBuffer2", runFunction: run_ExistentialTestOneMethodCall_ClassValueBuffer2, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestOneMethodCall_ClassValueBuffer3", runFunction: run_ExistentialTestOneMethodCall_ClassValueBuffer3, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestOneMethodCall_ClassValueBuffer4", runFunction: run_ExistentialTestOneMethodCall_ClassValueBuffer4, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestOneMethodCall_IntValueBuffer0", runFunction: run_ExistentialTestOneMethodCall_IntValueBuffer0, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestOneMethodCall_IntValueBuffer1", runFunction: run_ExistentialTestOneMethodCall_IntValueBuffer1, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestOneMethodCall_IntValueBuffer2", runFunction: run_ExistentialTestOneMethodCall_IntValueBuffer2, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestOneMethodCall_IntValueBuffer3", runFunction: run_ExistentialTestOneMethodCall_IntValueBuffer3, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestOneMethodCall_IntValueBuffer4", runFunction: run_ExistentialTestOneMethodCall_IntValueBuffer4, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestTwoMethodCalls_ClassValueBuffer1", runFunction: run_ExistentialTestTwoMethodCalls_ClassValueBuffer1, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestTwoMethodCalls_ClassValueBuffer2", runFunction: run_ExistentialTestTwoMethodCalls_ClassValueBuffer2, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestTwoMethodCalls_ClassValueBuffer3", runFunction: run_ExistentialTestTwoMethodCalls_ClassValueBuffer3, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestTwoMethodCalls_ClassValueBuffer4", runFunction: run_ExistentialTestTwoMethodCalls_ClassValueBuffer4, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestTwoMethodCalls_IntValueBuffer0", runFunction: run_ExistentialTestTwoMethodCalls_IntValueBuffer0, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestTwoMethodCalls_IntValueBuffer1", runFunction: run_ExistentialTestTwoMethodCalls_IntValueBuffer1, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestTwoMethodCalls_IntValueBuffer2", runFunction: run_ExistentialTestTwoMethodCalls_IntValueBuffer2, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestTwoMethodCalls_IntValueBuffer3", runFunction: run_ExistentialTestTwoMethodCalls_IntValueBuffer3, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestTwoMethodCalls_IntValueBuffer4", runFunction: run_ExistentialTestTwoMethodCalls_IntValueBuffer4, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestPassExistentialOneMethodCall_ClassValueBuffer1", runFunction: run_ExistentialTestPassExistentialOneMethodCall_ClassValueBuffer1, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestPassExistentialOneMethodCall_ClassValueBuffer2", runFunction: run_ExistentialTestPassExistentialOneMethodCall_ClassValueBuffer2, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestPassExistentialOneMethodCall_ClassValueBuffer3", runFunction: run_ExistentialTestPassExistentialOneMethodCall_ClassValueBuffer3, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestPassExistentialOneMethodCall_ClassValueBuffer4", runFunction: run_ExistentialTestPassExistentialOneMethodCall_ClassValueBuffer4, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestPassExistentialOneMethodCall_IntValueBuffer0", runFunction: run_ExistentialTestPassExistentialOneMethodCall_IntValueBuffer0, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestPassExistentialOneMethodCall_IntValueBuffer1", runFunction: run_ExistentialTestPassExistentialOneMethodCall_IntValueBuffer1, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestPassExistentialOneMethodCall_IntValueBuffer2", runFunction: run_ExistentialTestPassExistentialOneMethodCall_IntValueBuffer2, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestPassExistentialOneMethodCall_IntValueBuffer3", runFunction: run_ExistentialTestPassExistentialOneMethodCall_IntValueBuffer3, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestPassExistentialOneMethodCall_IntValueBuffer4", runFunction: run_ExistentialTestPassExistentialOneMethodCall_IntValueBuffer4, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestPassExistentialTwoMethodCalls_ClassValueBuffer1", runFunction: run_ExistentialTestPassExistentialTwoMethodCalls_ClassValueBuffer1, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestPassExistentialTwoMethodCalls_ClassValueBuffer2", runFunction: run_ExistentialTestPassExistentialTwoMethodCalls_ClassValueBuffer2, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestPassExistentialTwoMethodCalls_ClassValueBuffer3", runFunction: run_ExistentialTestPassExistentialTwoMethodCalls_ClassValueBuffer3, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestPassExistentialTwoMethodCalls_ClassValueBuffer4", runFunction: run_ExistentialTestPassExistentialTwoMethodCalls_ClassValueBuffer4, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestPassExistentialTwoMethodCalls_IntValueBuffer0", runFunction: run_ExistentialTestPassExistentialTwoMethodCalls_IntValueBuffer0, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestPassExistentialTwoMethodCalls_IntValueBuffer1", runFunction: run_ExistentialTestPassExistentialTwoMethodCalls_IntValueBuffer1, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestPassExistentialTwoMethodCalls_IntValueBuffer2", runFunction: run_ExistentialTestPassExistentialTwoMethodCalls_IntValueBuffer2, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestPassExistentialTwoMethodCalls_IntValueBuffer3", runFunction: run_ExistentialTestPassExistentialTwoMethodCalls_IntValueBuffer3, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestPassExistentialTwoMethodCalls_IntValueBuffer4", runFunction: run_ExistentialTestPassExistentialTwoMethodCalls_IntValueBuffer4, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestMutating_ClassValueBuffer1", runFunction: run_ExistentialTestMutating_ClassValueBuffer1, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestMutating_ClassValueBuffer2", runFunction: run_ExistentialTestMutating_ClassValueBuffer2, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestMutating_ClassValueBuffer3", runFunction: run_ExistentialTestMutating_ClassValueBuffer3, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestMutating_ClassValueBuffer4", runFunction: run_ExistentialTestMutating_ClassValueBuffer4, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestMutating_IntValueBuffer0", runFunction: run_ExistentialTestMutating_IntValueBuffer0, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestMutating_IntValueBuffer1", runFunction: run_ExistentialTestMutating_IntValueBuffer1, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestMutating_IntValueBuffer2", runFunction: run_ExistentialTestMutating_IntValueBuffer2, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestMutating_IntValueBuffer3", runFunction: run_ExistentialTestMutating_IntValueBuffer3, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestMutating_IntValueBuffer4", runFunction: run_ExistentialTestMutating_IntValueBuffer4, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestMutatingAndNonMutating_ClassValueBuffer1", runFunction: run_ExistentialTestMutatingAndNonMutating_ClassValueBuffer1, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestMutatingAndNonMutating_ClassValueBuffer2", runFunction: run_ExistentialTestMutatingAndNonMutating_ClassValueBuffer2, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestMutatingAndNonMutating_ClassValueBuffer3", runFunction: run_ExistentialTestMutatingAndNonMutating_ClassValueBuffer3, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestMutatingAndNonMutating_ClassValueBuffer4", runFunction: run_ExistentialTestMutatingAndNonMutating_ClassValueBuffer4, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestMutatingAndNonMutating_IntValueBuffer0", runFunction: run_ExistentialTestMutatingAndNonMutating_IntValueBuffer0, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestMutatingAndNonMutating_IntValueBuffer1", runFunction: run_ExistentialTestMutatingAndNonMutating_IntValueBuffer1, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestMutatingAndNonMutating_IntValueBuffer2", runFunction: run_ExistentialTestMutatingAndNonMutating_IntValueBuffer2, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestMutatingAndNonMutating_IntValueBuffer3", runFunction: run_ExistentialTestMutatingAndNonMutating_IntValueBuffer3, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestMutatingAndNonMutating_IntValueBuffer4", runFunction: run_ExistentialTestMutatingAndNonMutating_IntValueBuffer4, tags: [.unstable]), - BenchmarkInfo(name: "ExistentialTestArrayOneMethodCall_ClassValueBuffer1", runFunction: run_ExistentialTestArrayOneMethodCall_ClassValueBuffer1, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayOneMethodCall_ClassValueBuffer2", runFunction: run_ExistentialTestArrayOneMethodCall_ClassValueBuffer2, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayOneMethodCall_ClassValueBuffer3", runFunction: run_ExistentialTestArrayOneMethodCall_ClassValueBuffer3, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayOneMethodCall_ClassValueBuffer4", runFunction: run_ExistentialTestArrayOneMethodCall_ClassValueBuffer4, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayOneMethodCall_IntValueBuffer0", runFunction: run_ExistentialTestArrayOneMethodCall_IntValueBuffer0, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayOneMethodCall_IntValueBuffer1", runFunction: run_ExistentialTestArrayOneMethodCall_IntValueBuffer1, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayOneMethodCall_IntValueBuffer2", runFunction: run_ExistentialTestArrayOneMethodCall_IntValueBuffer2, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayOneMethodCall_IntValueBuffer3", runFunction: run_ExistentialTestArrayOneMethodCall_IntValueBuffer3, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayOneMethodCall_IntValueBuffer4", runFunction: run_ExistentialTestArrayOneMethodCall_IntValueBuffer4, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayTwoMethodCalls_ClassValueBuffer1", runFunction: run_ExistentialTestArrayTwoMethodCalls_ClassValueBuffer1, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayTwoMethodCalls_ClassValueBuffer2", runFunction: run_ExistentialTestArrayTwoMethodCalls_ClassValueBuffer2, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayTwoMethodCalls_ClassValueBuffer3", runFunction: run_ExistentialTestArrayTwoMethodCalls_ClassValueBuffer3, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayTwoMethodCalls_ClassValueBuffer4", runFunction: run_ExistentialTestArrayTwoMethodCalls_ClassValueBuffer4, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayTwoMethodCalls_IntValueBuffer0", runFunction: run_ExistentialTestArrayTwoMethodCalls_IntValueBuffer0, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayTwoMethodCalls_IntValueBuffer1", runFunction: run_ExistentialTestArrayTwoMethodCalls_IntValueBuffer1, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayTwoMethodCalls_IntValueBuffer2", runFunction: run_ExistentialTestArrayTwoMethodCalls_IntValueBuffer2, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayTwoMethodCalls_IntValueBuffer3", runFunction: run_ExistentialTestArrayTwoMethodCalls_IntValueBuffer3, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayTwoMethodCalls_IntValueBuffer4", runFunction: run_ExistentialTestArrayTwoMethodCalls_IntValueBuffer4, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayMutating_ClassValueBuffer1", runFunction: run_ExistentialTestArrayMutating_ClassValueBuffer1, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayMutating_ClassValueBuffer2", runFunction: run_ExistentialTestArrayMutating_ClassValueBuffer2, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayMutating_ClassValueBuffer3", runFunction: run_ExistentialTestArrayMutating_ClassValueBuffer3, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayMutating_ClassValueBuffer4", runFunction: run_ExistentialTestArrayMutating_ClassValueBuffer4, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayMutating_IntValueBuffer0", runFunction: run_ExistentialTestArrayMutating_IntValueBuffer0, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayMutating_IntValueBuffer1", runFunction: run_ExistentialTestArrayMutating_IntValueBuffer1, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayMutating_IntValueBuffer2", runFunction: run_ExistentialTestArrayMutating_IntValueBuffer2, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayMutating_IntValueBuffer3", runFunction: run_ExistentialTestArrayMutating_IntValueBuffer3, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayMutating_IntValueBuffer4", runFunction: run_ExistentialTestArrayMutating_IntValueBuffer4, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayShift_ClassValueBuffer1", runFunction: run_ExistentialTestArrayShift_ClassValueBuffer1, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayShift_ClassValueBuffer2", runFunction: run_ExistentialTestArrayShift_ClassValueBuffer2, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayShift_ClassValueBuffer3", runFunction: run_ExistentialTestArrayShift_ClassValueBuffer3, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayShift_ClassValueBuffer4", runFunction: run_ExistentialTestArrayShift_ClassValueBuffer4, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayShift_IntValueBuffer0", runFunction: run_ExistentialTestArrayShift_IntValueBuffer0, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayShift_IntValueBuffer1", runFunction: run_ExistentialTestArrayShift_IntValueBuffer1, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayShift_IntValueBuffer2", runFunction: run_ExistentialTestArrayShift_IntValueBuffer2, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayShift_IntValueBuffer3", runFunction: run_ExistentialTestArrayShift_IntValueBuffer3, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayShift_IntValueBuffer4", runFunction: run_ExistentialTestArrayShift_IntValueBuffer4, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayConditionalShift_ClassValueBuffer1", runFunction: run_ExistentialTestArrayConditionalShift_ClassValueBuffer1, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayConditionalShift_ClassValueBuffer2", runFunction: run_ExistentialTestArrayConditionalShift_ClassValueBuffer2, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayConditionalShift_ClassValueBuffer3", runFunction: run_ExistentialTestArrayConditionalShift_ClassValueBuffer3, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayConditionalShift_ClassValueBuffer4", runFunction: run_ExistentialTestArrayConditionalShift_ClassValueBuffer4, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayConditionalShift_IntValueBuffer0", runFunction: run_ExistentialTestArrayConditionalShift_IntValueBuffer0, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayConditionalShift_IntValueBuffer1", runFunction: run_ExistentialTestArrayConditionalShift_IntValueBuffer1, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayConditionalShift_IntValueBuffer2", runFunction: run_ExistentialTestArrayConditionalShift_IntValueBuffer2, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayConditionalShift_IntValueBuffer3", runFunction: run_ExistentialTestArrayConditionalShift_IntValueBuffer3, tags: [.unstable, .api, .Array]), - BenchmarkInfo(name: "ExistentialTestArrayConditionalShift_IntValueBuffer4", runFunction: run_ExistentialTestArrayConditionalShift_IntValueBuffer4, tags: [.unstable, .api, .Array]), +let t: [BenchmarkCategory] = [] +let ta: [BenchmarkCategory] = [.api, .Array] +public let ExistentialPerformance: [BenchmarkInfo] = [ + BenchmarkInfo(name: "Existential.method.1x.Ref1", runFunction: run_method1xRef1, tags: t), + BenchmarkInfo(name: "Existential.method.1x.Ref2", runFunction: run_method1xRef2, tags: t), + BenchmarkInfo(name: "Existential.method.1x.Ref3", runFunction: run_method1xRef3, tags: t), + BenchmarkInfo(name: "Existential.method.1x.Ref4", runFunction: run_method1xRef4, tags: t), + BenchmarkInfo(name: "Existential.method.1x.Val0", runFunction: run_method1xVal0, tags: t), + BenchmarkInfo(name: "Existential.method.1x.Val1", runFunction: run_method1xVal1, tags: t), + BenchmarkInfo(name: "Existential.method.1x.Val2", runFunction: run_method1xVal2, tags: t), + BenchmarkInfo(name: "Existential.method.1x.Val3", runFunction: run_method1xVal3, tags: t), + BenchmarkInfo(name: "Existential.method.1x.Val4", runFunction: run_method1xVal4, tags: t), + BenchmarkInfo(name: "Existential.method.2x.Ref1", runFunction: run_method2xRef1, tags: t), + BenchmarkInfo(name: "Existential.method.2x.Ref2", runFunction: run_method2xRef2, tags: t), + BenchmarkInfo(name: "Existential.method.2x.Ref3", runFunction: run_method2xRef3, tags: t), + BenchmarkInfo(name: "Existential.method.2x.Ref4", runFunction: run_method2xRef4, tags: t), + BenchmarkInfo(name: "Existential.method.2x.Val0", runFunction: run_method2xVal0, tags: t), + BenchmarkInfo(name: "Existential.method.2x.Val1", runFunction: run_method2xVal1, tags: t), + BenchmarkInfo(name: "Existential.method.2x.Val2", runFunction: run_method2xVal2, tags: t), + BenchmarkInfo(name: "Existential.method.2x.Val3", runFunction: run_method2xVal3, tags: t), + BenchmarkInfo(name: "Existential.method.2x.Val4", runFunction: run_method2xVal4, tags: t), + BenchmarkInfo(name: "Existential.Pass.method.1x.Ref1", runFunction: run_Pass_method1xRef1, tags: t), + BenchmarkInfo(name: "Existential.Pass.method.1x.Ref2", runFunction: run_Pass_method1xRef2, tags: t), + BenchmarkInfo(name: "Existential.Pass.method.1x.Ref3", runFunction: run_Pass_method1xRef3, tags: t), + BenchmarkInfo(name: "Existential.Pass.method.1x.Ref4", runFunction: run_Pass_method1xRef4, tags: t), + BenchmarkInfo(name: "Existential.Pass.method.1x.Val0", runFunction: run_Pass_method1xVal0, tags: t), + BenchmarkInfo(name: "Existential.Pass.method.1x.Val1", runFunction: run_Pass_method1xVal1, tags: t), + BenchmarkInfo(name: "Existential.Pass.method.1x.Val2", runFunction: run_Pass_method1xVal2, tags: t), + BenchmarkInfo(name: "Existential.Pass.method.1x.Val3", runFunction: run_Pass_method1xVal3, tags: t), + BenchmarkInfo(name: "Existential.Pass.method.1x.Val4", runFunction: run_Pass_method1xVal4, tags: t), + BenchmarkInfo(name: "Existential.Pass.method.2x.Ref1", runFunction: run_Pass_method2xRef1, tags: t), + BenchmarkInfo(name: "Existential.Pass.method.2x.Ref2", runFunction: run_Pass_method2xRef2, tags: t), + BenchmarkInfo(name: "Existential.Pass.method.2x.Ref3", runFunction: run_Pass_method2xRef3, tags: t), + BenchmarkInfo(name: "Existential.Pass.method.2x.Ref4", runFunction: run_Pass_method2xRef4, tags: t), + BenchmarkInfo(name: "Existential.Pass.method.2x.Val0", runFunction: run_Pass_method2xVal0, tags: t), + BenchmarkInfo(name: "Existential.Pass.method.2x.Val1", runFunction: run_Pass_method2xVal1, tags: t), + BenchmarkInfo(name: "Existential.Pass.method.2x.Val2", runFunction: run_Pass_method2xVal2, tags: t), + BenchmarkInfo(name: "Existential.Pass.method.2x.Val3", runFunction: run_Pass_method2xVal3, tags: t), + BenchmarkInfo(name: "Existential.Pass.method.2x.Val4", runFunction: run_Pass_method2xVal4, tags: t), + BenchmarkInfo(name: "Existential.Mutating.Ref1", runFunction: run_MutatingRef1, tags: t), + BenchmarkInfo(name: "Existential.Mutating.Ref2", runFunction: run_MutatingRef2, tags: t), + BenchmarkInfo(name: "Existential.Mutating.Ref3", runFunction: run_MutatingRef3, tags: t), + BenchmarkInfo(name: "Existential.Mutating.Ref4", runFunction: run_MutatingRef4, tags: t), + BenchmarkInfo(name: "Existential.Mutating.Val0", runFunction: run_MutatingVal0, tags: t), + BenchmarkInfo(name: "Existential.Mutating.Val1", runFunction: run_MutatingVal1, tags: t), + BenchmarkInfo(name: "Existential.Mutating.Val2", runFunction: run_MutatingVal2, tags: t), + BenchmarkInfo(name: "Existential.Mutating.Val3", runFunction: run_MutatingVal3, tags: t), + BenchmarkInfo(name: "Existential.Mutating.Val4", runFunction: run_MutatingVal4, tags: t), + BenchmarkInfo(name: "Existential.MutatingAndNonMutating.Ref1", runFunction: run_MutatingAndNonMutatingRef1, tags: t), + BenchmarkInfo(name: "Existential.MutatingAndNonMutating.Ref2", runFunction: run_MutatingAndNonMutatingRef2, tags: t), + BenchmarkInfo(name: "Existential.MutatingAndNonMutating.Ref3", runFunction: run_MutatingAndNonMutatingRef3, tags: t), + BenchmarkInfo(name: "Existential.MutatingAndNonMutating.Ref4", runFunction: run_MutatingAndNonMutatingRef4, tags: t), + BenchmarkInfo(name: "Existential.MutatingAndNonMutating.Val0", runFunction: run_MutatingAndNonMutatingVal0, tags: t), + BenchmarkInfo(name: "Existential.MutatingAndNonMutating.Val1", runFunction: run_MutatingAndNonMutatingVal1, tags: t), + BenchmarkInfo(name: "Existential.MutatingAndNonMutating.Val2", runFunction: run_MutatingAndNonMutatingVal2, tags: t), + BenchmarkInfo(name: "Existential.MutatingAndNonMutating.Val3", runFunction: run_MutatingAndNonMutatingVal3, tags: t), + BenchmarkInfo(name: "Existential.MutatingAndNonMutating.Val4", runFunction: run_MutatingAndNonMutatingVal4, tags: t), + BenchmarkInfo(name: "Existential.Array.method.1x.Ref1", runFunction: run_Array_method1xRef1, tags: ta), + BenchmarkInfo(name: "Existential.Array.method.1x.Ref2", runFunction: run_Array_method1xRef2, tags: ta), + BenchmarkInfo(name: "Existential.Array.method.1x.Ref3", runFunction: run_Array_method1xRef3, tags: ta), + BenchmarkInfo(name: "Existential.Array.method.1x.Ref4", runFunction: run_Array_method1xRef4, tags: ta), + BenchmarkInfo(name: "Existential.Array.method.1x.Val0", runFunction: run_Array_method1xVal0, tags: ta), + BenchmarkInfo(name: "Existential.Array.method.1x.Val1", runFunction: run_Array_method1xVal1, tags: ta), + BenchmarkInfo(name: "Existential.Array.method.1x.Val2", runFunction: run_Array_method1xVal2, tags: ta), + BenchmarkInfo(name: "Existential.Array.method.1x.Val3", runFunction: run_Array_method1xVal3, tags: ta), + BenchmarkInfo(name: "Existential.Array.method.1x.Val4", runFunction: run_Array_method1xVal4, tags: ta), + BenchmarkInfo(name: "Existential.Array.method.2x.Ref1", runFunction: run_Array_method2xRef1, tags: ta), + BenchmarkInfo(name: "Existential.Array.method.2x.Ref2", runFunction: run_Array_method2xRef2, tags: ta), + BenchmarkInfo(name: "Existential.Array.method.2x.Ref3", runFunction: run_Array_method2xRef3, tags: ta), + BenchmarkInfo(name: "Existential.Array.method.2x.Ref4", runFunction: run_Array_method2xRef4, tags: ta), + BenchmarkInfo(name: "Existential.Array.method.2x.Val0", runFunction: run_Array_method2xVal0, tags: ta), + BenchmarkInfo(name: "Existential.Array.method.2x.Val1", runFunction: run_Array_method2xVal1, tags: ta), + BenchmarkInfo(name: "Existential.Array.method.2x.Val2", runFunction: run_Array_method2xVal2, tags: ta), + BenchmarkInfo(name: "Existential.Array.method.2x.Val3", runFunction: run_Array_method2xVal3, tags: ta), + BenchmarkInfo(name: "Existential.Array.method.2x.Val4", runFunction: run_Array_method2xVal4, tags: ta), + BenchmarkInfo(name: "Existential.Array.Mutating.Ref1", runFunction: run_ArrayMutatingRef1, tags: ta), + BenchmarkInfo(name: "Existential.Array.Mutating.Ref2", runFunction: run_ArrayMutatingRef2, tags: ta), + BenchmarkInfo(name: "Existential.Array.Mutating.Ref3", runFunction: run_ArrayMutatingRef3, tags: ta), + BenchmarkInfo(name: "Existential.Array.Mutating.Ref4", runFunction: run_ArrayMutatingRef4, tags: ta), + BenchmarkInfo(name: "Existential.Array.Mutating.Val0", runFunction: run_ArrayMutatingVal0, tags: ta), + BenchmarkInfo(name: "Existential.Array.Mutating.Val1", runFunction: run_ArrayMutatingVal1, tags: ta), + BenchmarkInfo(name: "Existential.Array.Mutating.Val2", runFunction: run_ArrayMutatingVal2, tags: ta), + BenchmarkInfo(name: "Existential.Array.Mutating.Val3", runFunction: run_ArrayMutatingVal3, tags: ta), + BenchmarkInfo(name: "Existential.Array.Mutating.Val4", runFunction: run_ArrayMutatingVal4, tags: ta), + BenchmarkInfo(name: "Existential.Array.Shift.Ref1", runFunction: run_ArrayShiftRef1, tags: ta), + BenchmarkInfo(name: "Existential.Array.Shift.Ref2", runFunction: run_ArrayShiftRef2, tags: ta), + BenchmarkInfo(name: "Existential.Array.Shift.Ref3", runFunction: run_ArrayShiftRef3, tags: ta), + BenchmarkInfo(name: "Existential.Array.Shift.Ref4", runFunction: run_ArrayShiftRef4, tags: ta), + BenchmarkInfo(name: "Existential.Array.Shift.Val0", runFunction: run_ArrayShiftVal0, tags: ta), + BenchmarkInfo(name: "Existential.Array.Shift.Val1", runFunction: run_ArrayShiftVal1, tags: ta), + BenchmarkInfo(name: "Existential.Array.Shift.Val2", runFunction: run_ArrayShiftVal2, tags: ta), + BenchmarkInfo(name: "Existential.Array.Shift.Val3", runFunction: run_ArrayShiftVal3, tags: ta), + BenchmarkInfo(name: "Existential.Array.Shift.Val4", runFunction: run_ArrayShiftVal4, tags: ta), + BenchmarkInfo(name: "Existential.Array.ConditionalShift.Ref1", runFunction: run_ArrayConditionalShiftRef1, tags: ta), + BenchmarkInfo(name: "Existential.Array.ConditionalShift.Ref2", runFunction: run_ArrayConditionalShiftRef2, tags: ta), + BenchmarkInfo(name: "Existential.Array.ConditionalShift.Ref3", runFunction: run_ArrayConditionalShiftRef3, tags: ta), + BenchmarkInfo(name: "Existential.Array.ConditionalShift.Ref4", runFunction: run_ArrayConditionalShiftRef4, tags: ta), + BenchmarkInfo(name: "Existential.Array.ConditionalShift.Val0", runFunction: run_ArrayConditionalShiftVal0, tags: ta), + BenchmarkInfo(name: "Existential.Array.ConditionalShift.Val1", runFunction: run_ArrayConditionalShiftVal1, tags: ta), + BenchmarkInfo(name: "Existential.Array.ConditionalShift.Val2", runFunction: run_ArrayConditionalShiftVal2, tags: ta), + BenchmarkInfo(name: "Existential.Array.ConditionalShift.Val3", runFunction: run_ArrayConditionalShiftVal3, tags: ta), + BenchmarkInfo(name: "Existential.Array.ConditionalShift.Val4", runFunction: run_ArrayConditionalShiftVal4, tags: ta), ] protocol Existential { @@ -131,7 +133,7 @@ func next(_ x: inout Int, upto mod: Int) { x = (x + 1) % (mod + 1) } -struct IntValueBuffer0 : Existential { +struct Val0 : Existential { func doIt() -> Bool { return true } @@ -143,7 +145,7 @@ struct IntValueBuffer0 : Existential { } } -struct IntValueBuffer1 : Existential { +struct Val1 : Existential { var f0: Int = 0 func doIt() -> Bool { @@ -158,7 +160,7 @@ struct IntValueBuffer1 : Existential { } } -struct IntValueBuffer2 : Existential { +struct Val2 : Existential { var f0: Int = 0 var f1: Int = 3 @@ -175,7 +177,7 @@ struct IntValueBuffer2 : Existential { } } -struct IntValueBuffer3 : Existential { +struct Val3 : Existential { var f0: Int = 0 var f1: Int = 3 var f2: Int = 7 @@ -194,7 +196,7 @@ struct IntValueBuffer3 : Existential { } } -struct IntValueBuffer4 : Existential { +struct Val4 : Existential { var f0: Int = 0 var f1: Int = 3 var f2: Int = 7 @@ -232,7 +234,7 @@ class Klazz { // body same as Val2 } } -struct ClassValueBuffer1 : Existential { +struct Ref1 : Existential { var f0: Klazz = Klazz() func doIt() -> Bool { @@ -246,7 +248,7 @@ struct ClassValueBuffer1 : Existential { } } -struct ClassValueBuffer2 : Existential { +struct Ref2 : Existential { var f0: Klazz = Klazz() var f1: Klazz = Klazz() @@ -261,7 +263,7 @@ struct ClassValueBuffer2 : Existential { } } -struct ClassValueBuffer3 : Existential { +struct Ref3 : Existential { var f0: Klazz = Klazz() var f1: Klazz = Klazz() var f2: Klazz = Klazz() @@ -277,7 +279,7 @@ struct ClassValueBuffer3 : Existential { } } -struct ClassValueBuffer4 : Existential { +struct Ref4 : Existential { var f0: Klazz = Klazz() var f1: Klazz = Klazz() var f2: Klazz = Klazz() @@ -315,7 +317,7 @@ func passExistentialTwiceTwoMethodCalls(_ e0: Existential, _ e1: Existential) -> return e0.doIt() && e1.doIt() && e0.reallyDoIt() && e1.reallyDoIt() } -func runTestOneMethodCall(withType: T.Type, numberOfTimes N: Int) { +func run_method1x(withType: T.Type, numberOfTimes N: Int) { let existential = initExistential(withType: T.self) for _ in 0 ..< N * 20_000 { if !existential.doIt() { @@ -324,7 +326,7 @@ func runTestOneMethodCall(withType: T.Type, numberOfTimes N: Int } } -func runTestTwoMethodCalls(withType: T.Type, numberOfTimes N: Int) { +func run_method2x(withType: T.Type, numberOfTimes N: Int) { let existential = initExistential(withType: T.self) for _ in 0 ..< N * 20_000 { if !existential.doIt() || !existential.reallyDoIt() { @@ -333,7 +335,7 @@ func runTestTwoMethodCalls(withType: T.Type, numberOfTimes N: In } } -func runTestPassExistentialOneMethodCall(withType: T.Type, numberOfTimes N: Int) { +func run_Pass_method1x(withType: T.Type, numberOfTimes N: Int) { let existential = initExistential(withType: T.self) let existential2 = initExistential(withType: T.self) for _ in 0 ..< N * 20_000 { @@ -343,7 +345,7 @@ func runTestPassExistentialOneMethodCall(withType: T.Type, numbe } } -func runTestPassExistentialTwoMethodCalls(withType: T.Type, numberOfTimes N: Int) { +func run_Pass_method2x(withType: T.Type, numberOfTimes N: Int) { let existential = initExistential(withType: T.self) let existential2 = initExistential(withType: T.self) for _ in 0 ..< N * 20_000 { @@ -353,7 +355,7 @@ func runTestPassExistentialTwoMethodCalls(withType: T.Type, numb } } -func runTestMutating(withType: T.Type, numberOfTimes N: Int) { +func run_Mutating(withType: T.Type, numberOfTimes N: Int) { var existential = initExistential(withType: T.self) for _ in 0 ..< N * 10_000 { if !existential.mutateIt() { @@ -362,7 +364,7 @@ func runTestMutating(withType: T.Type, numberOfTimes N: Int) { } } -func runTestMutatingAndNonMutating(withType: T.Type, numberOfTimes N: Int) { +func run_MutatingAndNonMutating(withType: T.Type, numberOfTimes N: Int) { var existential = initExistential(withType: T.self) for _ in 0 ..< N * 10_000 { let _ = existential.doIt() @@ -372,7 +374,7 @@ func runTestMutatingAndNonMutating(withType: T.Type, numberOfTim } } -func runTestArrayOneMethodCall(withType: T.Type, numberOfTimes N: Int) { +func run_Array_method1x(withType: T.Type, numberOfTimes N: Int) { let existentialArray = initExistentialArray(withType: T.self, count: 128) for _ in 0 ..< N * 100 { for elt in existentialArray { @@ -383,7 +385,7 @@ func runTestArrayOneMethodCall(withType: T.Type, numberOfTimes N } } -func runTestArrayTwoMethodCalls(withType: T.Type, numberOfTimes N: Int) { +func run_Array_method2x(withType: T.Type, numberOfTimes N: Int) { let existentialArray = initExistentialArray(withType: T.self, count: 128) for _ in 0 ..< N * 100 { for elt in existentialArray { @@ -394,7 +396,7 @@ func runTestArrayTwoMethodCalls(withType: T.Type, numberOfTimes } } -func runTestArrayMutating(withType: T.Type, numberOfTimes N: Int) { +func run_ArrayMutating(withType: T.Type, numberOfTimes N: Int) { var existentialArray = initExistentialArray(withType: T.self, count: 128) for _ in 0 ..< N * 100 { for i in 0 ..< existentialArray.count { @@ -405,7 +407,7 @@ func runTestArrayMutating(withType: T.Type, numberOfTimes N: Int } } -func runTestArrayShift(withType: T.Type, numberOfTimes N: Int) { +func run_ArrayShift(withType: T.Type, numberOfTimes N: Int) { var existentialArray = initExistentialArray(withType: T.self, count: 128) for _ in 0 ..< N * 10 { for i in 0 ..< existentialArray.count-1 { @@ -414,7 +416,7 @@ func runTestArrayShift(withType: T.Type, numberOfTimes N: Int) { } } -func runTestArrayConditionalShift(withType: T.Type, numberOfTimes N: Int) { +func run_ArrayConditionalShift(withType: T.Type, numberOfTimes N: Int) { var existentialArray = initExistentialArray(withType: T.self, count: 128) for _ in 0 ..< N * 10 { for i in 0 ..< existentialArray.count-1 { @@ -427,323 +429,323 @@ func runTestArrayConditionalShift(withType: T.Type, numberOfTime } } -// TestOneMethodCall. -public func run_ExistentialTestOneMethodCall_IntValueBuffer0(_ N: Int) { - runTestOneMethodCall(withType: IntValueBuffer0.self, numberOfTimes: N) +// method.1x. +public func run_method1xVal0(_ N: Int) { + run_method1x(withType: Val0.self, numberOfTimes: N) } -public func run_ExistentialTestOneMethodCall_IntValueBuffer1(_ N: Int) { - runTestOneMethodCall(withType: IntValueBuffer1.self, numberOfTimes: N) +public func run_method1xVal1(_ N: Int) { + run_method1x(withType: Val1.self, numberOfTimes: N) } -public func run_ExistentialTestOneMethodCall_IntValueBuffer2(_ N: Int) { - runTestOneMethodCall(withType: IntValueBuffer2.self, numberOfTimes: N) +public func run_method1xVal2(_ N: Int) { + run_method1x(withType: Val2.self, numberOfTimes: N) } -public func run_ExistentialTestOneMethodCall_IntValueBuffer3(_ N: Int) { - runTestOneMethodCall(withType: IntValueBuffer3.self, numberOfTimes: N) +public func run_method1xVal3(_ N: Int) { + run_method1x(withType: Val3.self, numberOfTimes: N) } -public func run_ExistentialTestOneMethodCall_IntValueBuffer4(_ N: Int) { - runTestOneMethodCall(withType: IntValueBuffer4.self, numberOfTimes: N) +public func run_method1xVal4(_ N: Int) { + run_method1x(withType: Val4.self, numberOfTimes: N) } -public func run_ExistentialTestOneMethodCall_ClassValueBuffer1(_ N: Int) { - runTestOneMethodCall(withType: ClassValueBuffer1.self, numberOfTimes: N) +public func run_method1xRef1(_ N: Int) { + run_method1x(withType: Ref1.self, numberOfTimes: N) } -public func run_ExistentialTestOneMethodCall_ClassValueBuffer2(_ N: Int) { - runTestOneMethodCall(withType: ClassValueBuffer2.self, numberOfTimes: N) +public func run_method1xRef2(_ N: Int) { + run_method1x(withType: Ref2.self, numberOfTimes: N) } -public func run_ExistentialTestOneMethodCall_ClassValueBuffer3(_ N: Int) { - runTestOneMethodCall(withType: ClassValueBuffer3.self, numberOfTimes: N) +public func run_method1xRef3(_ N: Int) { + run_method1x(withType: Ref3.self, numberOfTimes: N) } -public func run_ExistentialTestOneMethodCall_ClassValueBuffer4(_ N: Int) { - runTestOneMethodCall(withType: ClassValueBuffer4.self, numberOfTimes: N) +public func run_method1xRef4(_ N: Int) { + run_method1x(withType: Ref4.self, numberOfTimes: N) } -// TestTwoMethodCalls. -public func run_ExistentialTestTwoMethodCalls_IntValueBuffer0(_ N: Int) { - runTestTwoMethodCalls(withType: IntValueBuffer0.self, numberOfTimes: N) +// method.2x. +public func run_method2xVal0(_ N: Int) { + run_method2x(withType: Val0.self, numberOfTimes: N) } -public func run_ExistentialTestTwoMethodCalls_IntValueBuffer1(_ N: Int) { - runTestTwoMethodCalls(withType: IntValueBuffer1.self, numberOfTimes: N) +public func run_method2xVal1(_ N: Int) { + run_method2x(withType: Val1.self, numberOfTimes: N) } -public func run_ExistentialTestTwoMethodCalls_IntValueBuffer2(_ N: Int) { - runTestTwoMethodCalls(withType: IntValueBuffer2.self, numberOfTimes: N) +public func run_method2xVal2(_ N: Int) { + run_method2x(withType: Val2.self, numberOfTimes: N) } -public func run_ExistentialTestTwoMethodCalls_IntValueBuffer3(_ N: Int) { - runTestTwoMethodCalls(withType: IntValueBuffer3.self, numberOfTimes: N) +public func run_method2xVal3(_ N: Int) { + run_method2x(withType: Val3.self, numberOfTimes: N) } -public func run_ExistentialTestTwoMethodCalls_IntValueBuffer4(_ N: Int) { - runTestTwoMethodCalls(withType: IntValueBuffer4.self, numberOfTimes: N) +public func run_method2xVal4(_ N: Int) { + run_method2x(withType: Val4.self, numberOfTimes: N) } -public func run_ExistentialTestTwoMethodCalls_ClassValueBuffer1(_ N: Int) { - runTestTwoMethodCalls(withType: ClassValueBuffer1.self, numberOfTimes: N) +public func run_method2xRef1(_ N: Int) { + run_method2x(withType: Ref1.self, numberOfTimes: N) } -public func run_ExistentialTestTwoMethodCalls_ClassValueBuffer2(_ N: Int) { - runTestTwoMethodCalls(withType: ClassValueBuffer2.self, numberOfTimes: N) +public func run_method2xRef2(_ N: Int) { + run_method2x(withType: Ref2.self, numberOfTimes: N) } -public func run_ExistentialTestTwoMethodCalls_ClassValueBuffer3(_ N: Int) { - runTestTwoMethodCalls(withType: ClassValueBuffer3.self, numberOfTimes: N) +public func run_method2xRef3(_ N: Int) { + run_method2x(withType: Ref3.self, numberOfTimes: N) } -public func run_ExistentialTestTwoMethodCalls_ClassValueBuffer4(_ N: Int) { - runTestTwoMethodCalls(withType: ClassValueBuffer4.self, numberOfTimes: N) +public func run_method2xRef4(_ N: Int) { + run_method2x(withType: Ref4.self, numberOfTimes: N) } -// TestPassExistentialOneMethodCall. -public func run_ExistentialTestPassExistentialOneMethodCall_IntValueBuffer0(_ N: Int) { - runTestPassExistentialOneMethodCall(withType: IntValueBuffer0.self, numberOfTimes: N) +// Pass.method.1x. +public func run_Pass_method1xVal0(_ N: Int) { + run_Pass_method1x(withType: Val0.self, numberOfTimes: N) } -public func run_ExistentialTestPassExistentialOneMethodCall_IntValueBuffer1(_ N: Int) { - runTestPassExistentialOneMethodCall(withType: IntValueBuffer1.self, numberOfTimes: N) +public func run_Pass_method1xVal1(_ N: Int) { + run_Pass_method1x(withType: Val1.self, numberOfTimes: N) } -public func run_ExistentialTestPassExistentialOneMethodCall_IntValueBuffer2(_ N: Int) { - runTestPassExistentialOneMethodCall(withType: IntValueBuffer2.self, numberOfTimes: N) +public func run_Pass_method1xVal2(_ N: Int) { + run_Pass_method1x(withType: Val2.self, numberOfTimes: N) } -public func run_ExistentialTestPassExistentialOneMethodCall_IntValueBuffer3(_ N: Int) { - runTestPassExistentialOneMethodCall(withType: IntValueBuffer3.self, numberOfTimes: N) +public func run_Pass_method1xVal3(_ N: Int) { + run_Pass_method1x(withType: Val3.self, numberOfTimes: N) } -public func run_ExistentialTestPassExistentialOneMethodCall_IntValueBuffer4(_ N: Int) { - runTestPassExistentialOneMethodCall(withType: IntValueBuffer4.self, numberOfTimes: N) +public func run_Pass_method1xVal4(_ N: Int) { + run_Pass_method1x(withType: Val4.self, numberOfTimes: N) } -public func run_ExistentialTestPassExistentialOneMethodCall_ClassValueBuffer1(_ N: Int) { - runTestPassExistentialOneMethodCall(withType: ClassValueBuffer1.self, numberOfTimes: N) +public func run_Pass_method1xRef1(_ N: Int) { + run_Pass_method1x(withType: Ref1.self, numberOfTimes: N) } -public func run_ExistentialTestPassExistentialOneMethodCall_ClassValueBuffer2(_ N: Int) { - runTestPassExistentialOneMethodCall(withType: ClassValueBuffer2.self, numberOfTimes: N) +public func run_Pass_method1xRef2(_ N: Int) { + run_Pass_method1x(withType: Ref2.self, numberOfTimes: N) } -public func run_ExistentialTestPassExistentialOneMethodCall_ClassValueBuffer3(_ N: Int) { - runTestPassExistentialOneMethodCall(withType: ClassValueBuffer3.self, numberOfTimes: N) +public func run_Pass_method1xRef3(_ N: Int) { + run_Pass_method1x(withType: Ref3.self, numberOfTimes: N) } -public func run_ExistentialTestPassExistentialOneMethodCall_ClassValueBuffer4(_ N: Int) { - runTestPassExistentialOneMethodCall(withType: ClassValueBuffer4.self, numberOfTimes: N) +public func run_Pass_method1xRef4(_ N: Int) { + run_Pass_method1x(withType: Ref4.self, numberOfTimes: N) } -// TestPassExistentialTwoMethodCalls. -public func run_ExistentialTestPassExistentialTwoMethodCalls_IntValueBuffer0(_ N: Int) { - runTestPassExistentialTwoMethodCalls(withType: IntValueBuffer0.self, numberOfTimes: N) +// Pass.method.2x. +public func run_Pass_method2xVal0(_ N: Int) { + run_Pass_method2x(withType: Val0.self, numberOfTimes: N) } -public func run_ExistentialTestPassExistentialTwoMethodCalls_IntValueBuffer1(_ N: Int) { - runTestPassExistentialTwoMethodCalls(withType: IntValueBuffer1.self, numberOfTimes: N) +public func run_Pass_method2xVal1(_ N: Int) { + run_Pass_method2x(withType: Val1.self, numberOfTimes: N) } -public func run_ExistentialTestPassExistentialTwoMethodCalls_IntValueBuffer2(_ N: Int) { - runTestPassExistentialTwoMethodCalls(withType: IntValueBuffer2.self, numberOfTimes: N) +public func run_Pass_method2xVal2(_ N: Int) { + run_Pass_method2x(withType: Val2.self, numberOfTimes: N) } -public func run_ExistentialTestPassExistentialTwoMethodCalls_IntValueBuffer3(_ N: Int) { - runTestPassExistentialTwoMethodCalls(withType: IntValueBuffer3.self, numberOfTimes: N) +public func run_Pass_method2xVal3(_ N: Int) { + run_Pass_method2x(withType: Val3.self, numberOfTimes: N) } -public func run_ExistentialTestPassExistentialTwoMethodCalls_IntValueBuffer4(_ N: Int) { - runTestPassExistentialTwoMethodCalls(withType: IntValueBuffer4.self, numberOfTimes: N) +public func run_Pass_method2xVal4(_ N: Int) { + run_Pass_method2x(withType: Val4.self, numberOfTimes: N) } -public func run_ExistentialTestPassExistentialTwoMethodCalls_ClassValueBuffer1(_ N: Int) { - runTestPassExistentialTwoMethodCalls(withType: ClassValueBuffer1.self, numberOfTimes: N) +public func run_Pass_method2xRef1(_ N: Int) { + run_Pass_method2x(withType: Ref1.self, numberOfTimes: N) } -public func run_ExistentialTestPassExistentialTwoMethodCalls_ClassValueBuffer2(_ N: Int) { - runTestPassExistentialTwoMethodCalls(withType: ClassValueBuffer2.self, numberOfTimes: N) +public func run_Pass_method2xRef2(_ N: Int) { + run_Pass_method2x(withType: Ref2.self, numberOfTimes: N) } -public func run_ExistentialTestPassExistentialTwoMethodCalls_ClassValueBuffer3(_ N: Int) { - runTestPassExistentialTwoMethodCalls(withType: ClassValueBuffer3.self, numberOfTimes: N) +public func run_Pass_method2xRef3(_ N: Int) { + run_Pass_method2x(withType: Ref3.self, numberOfTimes: N) } -public func run_ExistentialTestPassExistentialTwoMethodCalls_ClassValueBuffer4(_ N: Int) { - runTestPassExistentialTwoMethodCalls(withType: ClassValueBuffer4.self, numberOfTimes: N) +public func run_Pass_method2xRef4(_ N: Int) { + run_Pass_method2x(withType: Ref4.self, numberOfTimes: N) } -// TestMutating. -public func run_ExistentialTestMutating_IntValueBuffer0(_ N: Int) { - runTestMutating(withType: IntValueBuffer0.self, numberOfTimes: N) +// Mutating. +public func run_MutatingVal0(_ N: Int) { + run_Mutating(withType: Val0.self, numberOfTimes: N) } -public func run_ExistentialTestMutating_IntValueBuffer1(_ N: Int) { - runTestMutating(withType: IntValueBuffer1.self, numberOfTimes: N) +public func run_MutatingVal1(_ N: Int) { + run_Mutating(withType: Val1.self, numberOfTimes: N) } -public func run_ExistentialTestMutating_IntValueBuffer2(_ N: Int) { - runTestMutating(withType: IntValueBuffer2.self, numberOfTimes: N) +public func run_MutatingVal2(_ N: Int) { + run_Mutating(withType: Val2.self, numberOfTimes: N) } -public func run_ExistentialTestMutating_IntValueBuffer3(_ N: Int) { - runTestMutating(withType: IntValueBuffer3.self, numberOfTimes: N) +public func run_MutatingVal3(_ N: Int) { + run_Mutating(withType: Val3.self, numberOfTimes: N) } -public func run_ExistentialTestMutating_IntValueBuffer4(_ N: Int) { - runTestMutating(withType: IntValueBuffer4.self, numberOfTimes: N) +public func run_MutatingVal4(_ N: Int) { + run_Mutating(withType: Val4.self, numberOfTimes: N) } -public func run_ExistentialTestMutating_ClassValueBuffer1(_ N: Int) { - runTestMutating(withType: ClassValueBuffer1.self, numberOfTimes: N) +public func run_MutatingRef1(_ N: Int) { + run_Mutating(withType: Ref1.self, numberOfTimes: N) } -public func run_ExistentialTestMutating_ClassValueBuffer2(_ N: Int) { - runTestMutating(withType: ClassValueBuffer2.self, numberOfTimes: N) +public func run_MutatingRef2(_ N: Int) { + run_Mutating(withType: Ref2.self, numberOfTimes: N) } -public func run_ExistentialTestMutating_ClassValueBuffer3(_ N: Int) { - runTestMutating(withType: ClassValueBuffer3.self, numberOfTimes: N) +public func run_MutatingRef3(_ N: Int) { + run_Mutating(withType: Ref3.self, numberOfTimes: N) } -public func run_ExistentialTestMutating_ClassValueBuffer4(_ N: Int) { - runTestMutating(withType: ClassValueBuffer4.self, numberOfTimes: N) +public func run_MutatingRef4(_ N: Int) { + run_Mutating(withType: Ref4.self, numberOfTimes: N) } -// TestMutatingAndNonMutating. -public func run_ExistentialTestMutatingAndNonMutating_IntValueBuffer0(_ N: Int) { - runTestMutatingAndNonMutating(withType: IntValueBuffer0.self, numberOfTimes: N) +// MutatingAndNonMutating. +public func run_MutatingAndNonMutatingVal0(_ N: Int) { + run_MutatingAndNonMutating(withType: Val0.self, numberOfTimes: N) } -public func run_ExistentialTestMutatingAndNonMutating_IntValueBuffer1(_ N: Int) { - runTestMutatingAndNonMutating(withType: IntValueBuffer1.self, numberOfTimes: N) +public func run_MutatingAndNonMutatingVal1(_ N: Int) { + run_MutatingAndNonMutating(withType: Val1.self, numberOfTimes: N) } -public func run_ExistentialTestMutatingAndNonMutating_IntValueBuffer2(_ N: Int) { - runTestMutatingAndNonMutating(withType: IntValueBuffer2.self, numberOfTimes: N) +public func run_MutatingAndNonMutatingVal2(_ N: Int) { + run_MutatingAndNonMutating(withType: Val2.self, numberOfTimes: N) } -public func run_ExistentialTestMutatingAndNonMutating_IntValueBuffer3(_ N: Int) { - runTestMutatingAndNonMutating(withType: IntValueBuffer3.self, numberOfTimes: N) +public func run_MutatingAndNonMutatingVal3(_ N: Int) { + run_MutatingAndNonMutating(withType: Val3.self, numberOfTimes: N) } -public func run_ExistentialTestMutatingAndNonMutating_IntValueBuffer4(_ N: Int) { - runTestMutatingAndNonMutating(withType: IntValueBuffer4.self, numberOfTimes: N) +public func run_MutatingAndNonMutatingVal4(_ N: Int) { + run_MutatingAndNonMutating(withType: Val4.self, numberOfTimes: N) } -public func run_ExistentialTestMutatingAndNonMutating_ClassValueBuffer1(_ N: Int) { - runTestMutatingAndNonMutating(withType: ClassValueBuffer1.self, numberOfTimes: N) +public func run_MutatingAndNonMutatingRef1(_ N: Int) { + run_MutatingAndNonMutating(withType: Ref1.self, numberOfTimes: N) } -public func run_ExistentialTestMutatingAndNonMutating_ClassValueBuffer2(_ N: Int) { - runTestMutatingAndNonMutating(withType: ClassValueBuffer2.self, numberOfTimes: N) +public func run_MutatingAndNonMutatingRef2(_ N: Int) { + run_MutatingAndNonMutating(withType: Ref2.self, numberOfTimes: N) } -public func run_ExistentialTestMutatingAndNonMutating_ClassValueBuffer3(_ N: Int) { - runTestMutatingAndNonMutating(withType: ClassValueBuffer3.self, numberOfTimes: N) +public func run_MutatingAndNonMutatingRef3(_ N: Int) { + run_MutatingAndNonMutating(withType: Ref3.self, numberOfTimes: N) } -public func run_ExistentialTestMutatingAndNonMutating_ClassValueBuffer4(_ N: Int) { - runTestMutatingAndNonMutating(withType: ClassValueBuffer4.self, numberOfTimes: N) +public func run_MutatingAndNonMutatingRef4(_ N: Int) { + run_MutatingAndNonMutating(withType: Ref4.self, numberOfTimes: N) } -// TestArrayOneMethodCall. -public func run_ExistentialTestArrayOneMethodCall_IntValueBuffer0(_ N: Int) { - runTestArrayOneMethodCall(withType: IntValueBuffer0.self, numberOfTimes: N) +// Array.method.1x. +public func run_Array_method1xVal0(_ N: Int) { + run_Array_method1x(withType: Val0.self, numberOfTimes: N) } -public func run_ExistentialTestArrayOneMethodCall_IntValueBuffer1(_ N: Int) { - runTestArrayOneMethodCall(withType: IntValueBuffer1.self, numberOfTimes: N) +public func run_Array_method1xVal1(_ N: Int) { + run_Array_method1x(withType: Val1.self, numberOfTimes: N) } -public func run_ExistentialTestArrayOneMethodCall_IntValueBuffer2(_ N: Int) { - runTestArrayOneMethodCall(withType: IntValueBuffer2.self, numberOfTimes: N) +public func run_Array_method1xVal2(_ N: Int) { + run_Array_method1x(withType: Val2.self, numberOfTimes: N) } -public func run_ExistentialTestArrayOneMethodCall_IntValueBuffer3(_ N: Int) { - runTestArrayOneMethodCall(withType: IntValueBuffer3.self, numberOfTimes: N) +public func run_Array_method1xVal3(_ N: Int) { + run_Array_method1x(withType: Val3.self, numberOfTimes: N) } -public func run_ExistentialTestArrayOneMethodCall_IntValueBuffer4(_ N: Int) { - runTestArrayOneMethodCall(withType: IntValueBuffer4.self, numberOfTimes: N) +public func run_Array_method1xVal4(_ N: Int) { + run_Array_method1x(withType: Val4.self, numberOfTimes: N) } -public func run_ExistentialTestArrayOneMethodCall_ClassValueBuffer1(_ N: Int) { - runTestArrayOneMethodCall(withType: ClassValueBuffer1.self, numberOfTimes: N) +public func run_Array_method1xRef1(_ N: Int) { + run_Array_method1x(withType: Ref1.self, numberOfTimes: N) } -public func run_ExistentialTestArrayOneMethodCall_ClassValueBuffer2(_ N: Int) { - runTestArrayOneMethodCall(withType: ClassValueBuffer2.self, numberOfTimes: N) +public func run_Array_method1xRef2(_ N: Int) { + run_Array_method1x(withType: Ref2.self, numberOfTimes: N) } -public func run_ExistentialTestArrayOneMethodCall_ClassValueBuffer3(_ N: Int) { - runTestArrayOneMethodCall(withType: ClassValueBuffer3.self, numberOfTimes: N) +public func run_Array_method1xRef3(_ N: Int) { + run_Array_method1x(withType: Ref3.self, numberOfTimes: N) } -public func run_ExistentialTestArrayOneMethodCall_ClassValueBuffer4(_ N: Int) { - runTestArrayOneMethodCall(withType: ClassValueBuffer4.self, numberOfTimes: N) +public func run_Array_method1xRef4(_ N: Int) { + run_Array_method1x(withType: Ref4.self, numberOfTimes: N) } -// TestArrayTwoMethodCalls. -public func run_ExistentialTestArrayTwoMethodCalls_IntValueBuffer0(_ N: Int) { - runTestArrayTwoMethodCalls(withType: IntValueBuffer0.self, numberOfTimes: N) +// Array.method.2x. +public func run_Array_method2xVal0(_ N: Int) { + run_Array_method2x(withType: Val0.self, numberOfTimes: N) } -public func run_ExistentialTestArrayTwoMethodCalls_IntValueBuffer1(_ N: Int) { - runTestArrayTwoMethodCalls(withType: IntValueBuffer1.self, numberOfTimes: N) +public func run_Array_method2xVal1(_ N: Int) { + run_Array_method2x(withType: Val1.self, numberOfTimes: N) } -public func run_ExistentialTestArrayTwoMethodCalls_IntValueBuffer2(_ N: Int) { - runTestArrayTwoMethodCalls(withType: IntValueBuffer2.self, numberOfTimes: N) +public func run_Array_method2xVal2(_ N: Int) { + run_Array_method2x(withType: Val2.self, numberOfTimes: N) } -public func run_ExistentialTestArrayTwoMethodCalls_IntValueBuffer3(_ N: Int) { - runTestArrayTwoMethodCalls(withType: IntValueBuffer3.self, numberOfTimes: N) +public func run_Array_method2xVal3(_ N: Int) { + run_Array_method2x(withType: Val3.self, numberOfTimes: N) } -public func run_ExistentialTestArrayTwoMethodCalls_IntValueBuffer4(_ N: Int) { - runTestArrayTwoMethodCalls(withType: IntValueBuffer4.self, numberOfTimes: N) +public func run_Array_method2xVal4(_ N: Int) { + run_Array_method2x(withType: Val4.self, numberOfTimes: N) } -public func run_ExistentialTestArrayTwoMethodCalls_ClassValueBuffer1(_ N: Int) { - runTestArrayTwoMethodCalls(withType: ClassValueBuffer1.self, numberOfTimes: N) +public func run_Array_method2xRef1(_ N: Int) { + run_Array_method2x(withType: Ref1.self, numberOfTimes: N) } -public func run_ExistentialTestArrayTwoMethodCalls_ClassValueBuffer2(_ N: Int) { - runTestArrayTwoMethodCalls(withType: ClassValueBuffer2.self, numberOfTimes: N) +public func run_Array_method2xRef2(_ N: Int) { + run_Array_method2x(withType: Ref2.self, numberOfTimes: N) } -public func run_ExistentialTestArrayTwoMethodCalls_ClassValueBuffer3(_ N: Int) { - runTestArrayTwoMethodCalls(withType: ClassValueBuffer3.self, numberOfTimes: N) +public func run_Array_method2xRef3(_ N: Int) { + run_Array_method2x(withType: Ref3.self, numberOfTimes: N) } -public func run_ExistentialTestArrayTwoMethodCalls_ClassValueBuffer4(_ N: Int) { - runTestArrayTwoMethodCalls(withType: ClassValueBuffer4.self, numberOfTimes: N) +public func run_Array_method2xRef4(_ N: Int) { + run_Array_method2x(withType: Ref4.self, numberOfTimes: N) } -// TestArrayMutating. -public func run_ExistentialTestArrayMutating_IntValueBuffer0(_ N: Int) { - runTestArrayMutating(withType: IntValueBuffer0.self, numberOfTimes: N) +// Array.Mutating. +public func run_ArrayMutatingVal0(_ N: Int) { + run_ArrayMutating(withType: Val0.self, numberOfTimes: N) } -public func run_ExistentialTestArrayMutating_IntValueBuffer1(_ N: Int) { - runTestArrayMutating(withType: IntValueBuffer1.self, numberOfTimes: N) +public func run_ArrayMutatingVal1(_ N: Int) { + run_ArrayMutating(withType: Val1.self, numberOfTimes: N) } -public func run_ExistentialTestArrayMutating_IntValueBuffer2(_ N: Int) { - runTestArrayMutating(withType: IntValueBuffer2.self, numberOfTimes: N) +public func run_ArrayMutatingVal2(_ N: Int) { + run_ArrayMutating(withType: Val2.self, numberOfTimes: N) } -public func run_ExistentialTestArrayMutating_IntValueBuffer3(_ N: Int) { - runTestArrayMutating(withType: IntValueBuffer3.self, numberOfTimes: N) +public func run_ArrayMutatingVal3(_ N: Int) { + run_ArrayMutating(withType: Val3.self, numberOfTimes: N) } -public func run_ExistentialTestArrayMutating_IntValueBuffer4(_ N: Int) { - runTestArrayMutating(withType: IntValueBuffer4.self, numberOfTimes: N) +public func run_ArrayMutatingVal4(_ N: Int) { + run_ArrayMutating(withType: Val4.self, numberOfTimes: N) } -public func run_ExistentialTestArrayMutating_ClassValueBuffer1(_ N: Int) { - runTestArrayMutating(withType: ClassValueBuffer1.self, numberOfTimes: N) +public func run_ArrayMutatingRef1(_ N: Int) { + run_ArrayMutating(withType: Ref1.self, numberOfTimes: N) } -public func run_ExistentialTestArrayMutating_ClassValueBuffer2(_ N: Int) { - runTestArrayMutating(withType: ClassValueBuffer2.self, numberOfTimes: N) +public func run_ArrayMutatingRef2(_ N: Int) { + run_ArrayMutating(withType: Ref2.self, numberOfTimes: N) } -public func run_ExistentialTestArrayMutating_ClassValueBuffer3(_ N: Int) { - runTestArrayMutating(withType: ClassValueBuffer3.self, numberOfTimes: N) +public func run_ArrayMutatingRef3(_ N: Int) { + run_ArrayMutating(withType: Ref3.self, numberOfTimes: N) } -public func run_ExistentialTestArrayMutating_ClassValueBuffer4(_ N: Int) { - runTestArrayMutating(withType: ClassValueBuffer4.self, numberOfTimes: N) +public func run_ArrayMutatingRef4(_ N: Int) { + run_ArrayMutating(withType: Ref4.self, numberOfTimes: N) } -// TestArrayShift. -public func run_ExistentialTestArrayShift_IntValueBuffer0(_ N: Int) { - runTestArrayShift(withType: IntValueBuffer0.self, numberOfTimes: N) +// Array.Shift. +public func run_ArrayShiftVal0(_ N: Int) { + run_ArrayShift(withType: Val0.self, numberOfTimes: N) } -public func run_ExistentialTestArrayShift_IntValueBuffer1(_ N: Int) { - runTestArrayShift(withType: IntValueBuffer1.self, numberOfTimes: N) +public func run_ArrayShiftVal1(_ N: Int) { + run_ArrayShift(withType: Val1.self, numberOfTimes: N) } -public func run_ExistentialTestArrayShift_IntValueBuffer2(_ N: Int) { - runTestArrayShift(withType: IntValueBuffer2.self, numberOfTimes: N) +public func run_ArrayShiftVal2(_ N: Int) { + run_ArrayShift(withType: Val2.self, numberOfTimes: N) } -public func run_ExistentialTestArrayShift_IntValueBuffer3(_ N: Int) { - runTestArrayShift(withType: IntValueBuffer3.self, numberOfTimes: N) +public func run_ArrayShiftVal3(_ N: Int) { + run_ArrayShift(withType: Val3.self, numberOfTimes: N) } -public func run_ExistentialTestArrayShift_IntValueBuffer4(_ N: Int) { - runTestArrayShift(withType: IntValueBuffer4.self, numberOfTimes: N) +public func run_ArrayShiftVal4(_ N: Int) { + run_ArrayShift(withType: Val4.self, numberOfTimes: N) } -public func run_ExistentialTestArrayShift_ClassValueBuffer1(_ N: Int) { - runTestArrayShift(withType: ClassValueBuffer1.self, numberOfTimes: N) +public func run_ArrayShiftRef1(_ N: Int) { + run_ArrayShift(withType: Ref1.self, numberOfTimes: N) } -public func run_ExistentialTestArrayShift_ClassValueBuffer2(_ N: Int) { - runTestArrayShift(withType: ClassValueBuffer2.self, numberOfTimes: N) +public func run_ArrayShiftRef2(_ N: Int) { + run_ArrayShift(withType: Ref2.self, numberOfTimes: N) } -public func run_ExistentialTestArrayShift_ClassValueBuffer3(_ N: Int) { - runTestArrayShift(withType: ClassValueBuffer3.self, numberOfTimes: N) +public func run_ArrayShiftRef3(_ N: Int) { + run_ArrayShift(withType: Ref3.self, numberOfTimes: N) } -public func run_ExistentialTestArrayShift_ClassValueBuffer4(_ N: Int) { - runTestArrayShift(withType: ClassValueBuffer4.self, numberOfTimes: N) +public func run_ArrayShiftRef4(_ N: Int) { + run_ArrayShift(withType: Ref4.self, numberOfTimes: N) } -// TestArrayConditionalShift. -public func run_ExistentialTestArrayConditionalShift_IntValueBuffer0(_ N: Int) { - runTestArrayConditionalShift(withType: IntValueBuffer0.self, numberOfTimes: N) +// Array.ConditionalShift. +public func run_ArrayConditionalShiftVal0(_ N: Int) { + run_ArrayConditionalShift(withType: Val0.self, numberOfTimes: N) } -public func run_ExistentialTestArrayConditionalShift_IntValueBuffer1(_ N: Int) { - runTestArrayConditionalShift(withType: IntValueBuffer1.self, numberOfTimes: N) +public func run_ArrayConditionalShiftVal1(_ N: Int) { + run_ArrayConditionalShift(withType: Val1.self, numberOfTimes: N) } -public func run_ExistentialTestArrayConditionalShift_IntValueBuffer2(_ N: Int) { - runTestArrayConditionalShift(withType: IntValueBuffer2.self, numberOfTimes: N) +public func run_ArrayConditionalShiftVal2(_ N: Int) { + run_ArrayConditionalShift(withType: Val2.self, numberOfTimes: N) } -public func run_ExistentialTestArrayConditionalShift_IntValueBuffer3(_ N: Int) { - runTestArrayConditionalShift(withType: IntValueBuffer3.self, numberOfTimes: N) +public func run_ArrayConditionalShiftVal3(_ N: Int) { + run_ArrayConditionalShift(withType: Val3.self, numberOfTimes: N) } -public func run_ExistentialTestArrayConditionalShift_IntValueBuffer4(_ N: Int) { - runTestArrayConditionalShift(withType: IntValueBuffer4.self, numberOfTimes: N) +public func run_ArrayConditionalShiftVal4(_ N: Int) { + run_ArrayConditionalShift(withType: Val4.self, numberOfTimes: N) } -public func run_ExistentialTestArrayConditionalShift_ClassValueBuffer1(_ N: Int) { - runTestArrayConditionalShift(withType: ClassValueBuffer1.self, numberOfTimes: N) +public func run_ArrayConditionalShiftRef1(_ N: Int) { + run_ArrayConditionalShift(withType: Ref1.self, numberOfTimes: N) } -public func run_ExistentialTestArrayConditionalShift_ClassValueBuffer2(_ N: Int) { - runTestArrayConditionalShift(withType: ClassValueBuffer2.self, numberOfTimes: N) +public func run_ArrayConditionalShiftRef2(_ N: Int) { + run_ArrayConditionalShift(withType: Ref2.self, numberOfTimes: N) } -public func run_ExistentialTestArrayConditionalShift_ClassValueBuffer3(_ N: Int) { - runTestArrayConditionalShift(withType: ClassValueBuffer3.self, numberOfTimes: N) +public func run_ArrayConditionalShiftRef3(_ N: Int) { + run_ArrayConditionalShift(withType: Ref3.self, numberOfTimes: N) } -public func run_ExistentialTestArrayConditionalShift_ClassValueBuffer4(_ N: Int) { - runTestArrayConditionalShift(withType: ClassValueBuffer4.self, numberOfTimes: N) +public func run_ArrayConditionalShiftRef4(_ N: Int) { + run_ArrayConditionalShift(withType: Ref4.self, numberOfTimes: N) } // Local Variables: diff --git a/benchmark/single-source/ExistentialPerformance.swift.gyb b/benchmark/single-source/ExistentialPerformance.swift.gyb index 933059528ccf3..c5f3c976948ca 100644 --- a/benchmark/single-source/ExistentialPerformance.swift.gyb +++ b/benchmark/single-source/ExistentialPerformance.swift.gyb @@ -19,6 +19,8 @@ import TestsUtils +let t: [BenchmarkCategory] = [] +let ta: [BenchmarkCategory] = [.api, .Array] %{ Setup = """ let existentialArray = initExistentialArray(withType: T.self, count: 128) @@ -30,22 +32,22 @@ Setup = """ Setup = [Setup[0], Setup[1], '\n'.join(Setup[1:3]), Setup[3], Setup[4]] Workloads = [ - ('OneMethodCall', Setup[1], '20_000', """ + ('method.1x', Setup[1], '20_000', """ if !existential.doIt() { fatalError("expected true") } """), - ('TwoMethodCalls', Setup[1], '20_000', """ + ('method.2x', Setup[1], '20_000', """ if !existential.doIt() || !existential.reallyDoIt() { fatalError("expected true") } """), - ('PassExistentialOneMethodCall', Setup[2], '20_000', """ + ('Pass.method.1x', Setup[2], '20_000', """ if !passExistentialTwiceOneMethodCall(existential, existential2) { fatalError("expected true") } """), - ('PassExistentialTwoMethodCalls', Setup[2], '20_000', """ + ('Pass.method.2x', Setup[2], '20_000', """ if !passExistentialTwiceTwoMethodCalls(existential, existential2) { fatalError("expected true") } @@ -61,33 +63,33 @@ Workloads = [ fatalError("expected true") } """), - ('ArrayOneMethodCall', Setup[0], '100', """ + ('Array.method.1x', Setup[0], '100', """ for elt in existentialArray { if !elt.doIt() { fatalError("expected true") } } """), - ('ArrayTwoMethodCalls', Setup[0], '100', """ + ('Array.method.2x', Setup[0], '100', """ for elt in existentialArray { if !elt.doIt() || !elt.reallyDoIt() { fatalError("expected true") } } """), - ('ArrayMutating', Setup[4], '100', """ + ('Array.Mutating', Setup[4], '100', """ for i in 0 ..< existentialArray.count { if !existentialArray[i].mutateIt() { fatalError("expected true") } } """), - ('ArrayShift', Setup[4], '10', """ + ('Array.Shift', Setup[4], '10', """ for i in 0 ..< existentialArray.count-1 { existentialArray.swapAt(i, i+1) } """), - ('ArrayConditionalShift', Setup[4], '10', """ + ('Array.ConditionalShift', Setup[4], '10', """ for i in 0 ..< existentialArray.count-1 { let curr = existentialArray[i] if curr.doIt() { @@ -98,15 +100,28 @@ Workloads = [ """), ] Vars = [(0, 0), (1, 3), (2, 7), (3, 13)] -Refs = ['ClassValueBuffer' + str(i) for i in range(1, 5)] -Vals = ['IntValueBuffer' + str(i) for i in range(0, 5)] -Names = ['ExistentialTest' + group + '_' + variant +Refs = ['Ref' + str(i) for i in range(1, 5)] +Vals = ['Val' + str(i) for i in range(0, 5)] +Names = [group + '.' + variant for (group, _, _, _) in Workloads for variant in Refs + Vals] + +import re + +method_variant_re = re.compile(r'\.([a-z])') +control_flow_separator_re = re.compile(r'-') +group_separator_re = re.compile(r'\.') + +def run_function_name(benchmark_name): + return 'run_' + group_separator_re.sub( # remove dots + '', method_variant_re.sub( # replace .methodName with _methodName + r'_\1', control_flow_separator_re.sub( # remove dashes + '', benchmark_name))) }% -public let ExistentialPerformance = [ +public let ExistentialPerformance: [BenchmarkInfo] = [ % for Name in Names: - BenchmarkInfo(name: "${Name}", runFunction: run_${Name}, tags: [.unstable${ - ', .api, .Array' if 'Array' in Name else ''}]), + BenchmarkInfo(name: "Existential.${Name}", runFunction: ${ + run_function_name(Name)}, tags: ${ + 'ta' if 'Array' in Name else 't'}), % end ] @@ -199,17 +214,17 @@ func passExistentialTwiceTwoMethodCalls(_ e0: Existential, _ e1: Existential) -> } % for (name, setup, multiple, workload) in Workloads: ${""" -func runTest{0}(withType: T.Type, numberOfTimes N: Int) {{ +func {0}(withType: T.Type, numberOfTimes N: Int) {{ {1} for _ in 0 ..< N * {2} {{{3} }} -}}""".format(name, setup, multiple, workload)} +}}""".format(run_function_name(name), setup, multiple, workload)} % end % for (Name, _, _, _) in Workloads: -// Test${Name}. +// ${Name}. % for Variant in Vals + Refs: -public func run_ExistentialTest${Name}_${Variant}(_ N: Int) { - runTest${Name}(withType: ${Variant}.self, numberOfTimes: N) +public func ${run_function_name(Name + '.' + Variant)}(_ N: Int) { + ${run_function_name(Name)}(withType: ${Variant}.self, numberOfTimes: N) } % end From 27026333862c8b5aedc9ee6aa35cc0254e02d323 Mon Sep 17 00:00:00 2001 From: Pavol Vaskovic Date: Fri, 16 Nov 2018 21:35:27 +0100 Subject: [PATCH 06/12] [benchmark] Extract setup from Existential.Array MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Existential.Array group had setup overhead caused by initialization of the existential array. Since this seems to be quite substatial and is dependant on the existential type, it makes sense to add Array.init benchmark group that will measure it explicitly. Array setup is extracted into 9 type-specific functions. The setup inside the `run_` functions now grabs that array, prepared in `setUpFunction`, excluding the initialization from the measurement. This helped with extracting setup overhead from most cases, but it appears that the mutable test still have measurable overhead because they perform COW. I’ve tried to work around this by transfering ownership of the pre-initialized array with the `grabArray` function, but nilling the IUO was crashing at runtime. This should be fixed later. --- .../ExistentialPerformance.swift | 172 +++++++++++++----- .../ExistentialPerformance.swift.gyb | 45 ++++- 2 files changed, 157 insertions(+), 60 deletions(-) diff --git a/benchmark/single-source/ExistentialPerformance.swift b/benchmark/single-source/ExistentialPerformance.swift index d44e8954f989f..c05e69c918a5b 100644 --- a/benchmark/single-source/ExistentialPerformance.swift +++ b/benchmark/single-source/ExistentialPerformance.swift @@ -75,53 +75,89 @@ public let ExistentialPerformance: [BenchmarkInfo] = [ BenchmarkInfo(name: "Existential.MutatingAndNonMutating.Val2", runFunction: run_MutatingAndNonMutatingVal2, tags: t), BenchmarkInfo(name: "Existential.MutatingAndNonMutating.Val3", runFunction: run_MutatingAndNonMutatingVal3, tags: t), BenchmarkInfo(name: "Existential.MutatingAndNonMutating.Val4", runFunction: run_MutatingAndNonMutatingVal4, tags: t), - BenchmarkInfo(name: "Existential.Array.method.1x.Ref1", runFunction: run_Array_method1xRef1, tags: ta), - BenchmarkInfo(name: "Existential.Array.method.1x.Ref2", runFunction: run_Array_method1xRef2, tags: ta), - BenchmarkInfo(name: "Existential.Array.method.1x.Ref3", runFunction: run_Array_method1xRef3, tags: ta), - BenchmarkInfo(name: "Existential.Array.method.1x.Ref4", runFunction: run_Array_method1xRef4, tags: ta), - BenchmarkInfo(name: "Existential.Array.method.1x.Val0", runFunction: run_Array_method1xVal0, tags: ta), - BenchmarkInfo(name: "Existential.Array.method.1x.Val1", runFunction: run_Array_method1xVal1, tags: ta), - BenchmarkInfo(name: "Existential.Array.method.1x.Val2", runFunction: run_Array_method1xVal2, tags: ta), - BenchmarkInfo(name: "Existential.Array.method.1x.Val3", runFunction: run_Array_method1xVal3, tags: ta), - BenchmarkInfo(name: "Existential.Array.method.1x.Val4", runFunction: run_Array_method1xVal4, tags: ta), - BenchmarkInfo(name: "Existential.Array.method.2x.Ref1", runFunction: run_Array_method2xRef1, tags: ta), - BenchmarkInfo(name: "Existential.Array.method.2x.Ref2", runFunction: run_Array_method2xRef2, tags: ta), - BenchmarkInfo(name: "Existential.Array.method.2x.Ref3", runFunction: run_Array_method2xRef3, tags: ta), - BenchmarkInfo(name: "Existential.Array.method.2x.Ref4", runFunction: run_Array_method2xRef4, tags: ta), - BenchmarkInfo(name: "Existential.Array.method.2x.Val0", runFunction: run_Array_method2xVal0, tags: ta), - BenchmarkInfo(name: "Existential.Array.method.2x.Val1", runFunction: run_Array_method2xVal1, tags: ta), - BenchmarkInfo(name: "Existential.Array.method.2x.Val2", runFunction: run_Array_method2xVal2, tags: ta), - BenchmarkInfo(name: "Existential.Array.method.2x.Val3", runFunction: run_Array_method2xVal3, tags: ta), - BenchmarkInfo(name: "Existential.Array.method.2x.Val4", runFunction: run_Array_method2xVal4, tags: ta), - BenchmarkInfo(name: "Existential.Array.Mutating.Ref1", runFunction: run_ArrayMutatingRef1, tags: ta), - BenchmarkInfo(name: "Existential.Array.Mutating.Ref2", runFunction: run_ArrayMutatingRef2, tags: ta), - BenchmarkInfo(name: "Existential.Array.Mutating.Ref3", runFunction: run_ArrayMutatingRef3, tags: ta), - BenchmarkInfo(name: "Existential.Array.Mutating.Ref4", runFunction: run_ArrayMutatingRef4, tags: ta), - BenchmarkInfo(name: "Existential.Array.Mutating.Val0", runFunction: run_ArrayMutatingVal0, tags: ta), - BenchmarkInfo(name: "Existential.Array.Mutating.Val1", runFunction: run_ArrayMutatingVal1, tags: ta), - BenchmarkInfo(name: "Existential.Array.Mutating.Val2", runFunction: run_ArrayMutatingVal2, tags: ta), - BenchmarkInfo(name: "Existential.Array.Mutating.Val3", runFunction: run_ArrayMutatingVal3, tags: ta), - BenchmarkInfo(name: "Existential.Array.Mutating.Val4", runFunction: run_ArrayMutatingVal4, tags: ta), - BenchmarkInfo(name: "Existential.Array.Shift.Ref1", runFunction: run_ArrayShiftRef1, tags: ta), - BenchmarkInfo(name: "Existential.Array.Shift.Ref2", runFunction: run_ArrayShiftRef2, tags: ta), - BenchmarkInfo(name: "Existential.Array.Shift.Ref3", runFunction: run_ArrayShiftRef3, tags: ta), - BenchmarkInfo(name: "Existential.Array.Shift.Ref4", runFunction: run_ArrayShiftRef4, tags: ta), - BenchmarkInfo(name: "Existential.Array.Shift.Val0", runFunction: run_ArrayShiftVal0, tags: ta), - BenchmarkInfo(name: "Existential.Array.Shift.Val1", runFunction: run_ArrayShiftVal1, tags: ta), - BenchmarkInfo(name: "Existential.Array.Shift.Val2", runFunction: run_ArrayShiftVal2, tags: ta), - BenchmarkInfo(name: "Existential.Array.Shift.Val3", runFunction: run_ArrayShiftVal3, tags: ta), - BenchmarkInfo(name: "Existential.Array.Shift.Val4", runFunction: run_ArrayShiftVal4, tags: ta), - BenchmarkInfo(name: "Existential.Array.ConditionalShift.Ref1", runFunction: run_ArrayConditionalShiftRef1, tags: ta), - BenchmarkInfo(name: "Existential.Array.ConditionalShift.Ref2", runFunction: run_ArrayConditionalShiftRef2, tags: ta), - BenchmarkInfo(name: "Existential.Array.ConditionalShift.Ref3", runFunction: run_ArrayConditionalShiftRef3, tags: ta), - BenchmarkInfo(name: "Existential.Array.ConditionalShift.Ref4", runFunction: run_ArrayConditionalShiftRef4, tags: ta), - BenchmarkInfo(name: "Existential.Array.ConditionalShift.Val0", runFunction: run_ArrayConditionalShiftVal0, tags: ta), - BenchmarkInfo(name: "Existential.Array.ConditionalShift.Val1", runFunction: run_ArrayConditionalShiftVal1, tags: ta), - BenchmarkInfo(name: "Existential.Array.ConditionalShift.Val2", runFunction: run_ArrayConditionalShiftVal2, tags: ta), - BenchmarkInfo(name: "Existential.Array.ConditionalShift.Val3", runFunction: run_ArrayConditionalShiftVal3, tags: ta), - BenchmarkInfo(name: "Existential.Array.ConditionalShift.Val4", runFunction: run_ArrayConditionalShiftVal4, tags: ta), + BenchmarkInfo(name: "Existential.Array.init.Ref1", runFunction: run_Array_initRef1, tags: ta, setUpFunction: caRef1), + BenchmarkInfo(name: "Existential.Array.init.Ref2", runFunction: run_Array_initRef2, tags: ta, setUpFunction: caRef2), + BenchmarkInfo(name: "Existential.Array.init.Ref3", runFunction: run_Array_initRef3, tags: ta, setUpFunction: caRef3), + BenchmarkInfo(name: "Existential.Array.init.Ref4", runFunction: run_Array_initRef4, tags: ta, setUpFunction: caRef4), + BenchmarkInfo(name: "Existential.Array.init.Val0", runFunction: run_Array_initVal0, tags: ta, setUpFunction: caVal0), + BenchmarkInfo(name: "Existential.Array.init.Val1", runFunction: run_Array_initVal1, tags: ta, setUpFunction: caVal1), + BenchmarkInfo(name: "Existential.Array.init.Val2", runFunction: run_Array_initVal2, tags: ta, setUpFunction: caVal2), + BenchmarkInfo(name: "Existential.Array.init.Val3", runFunction: run_Array_initVal3, tags: ta, setUpFunction: caVal3), + BenchmarkInfo(name: "Existential.Array.init.Val4", runFunction: run_Array_initVal4, tags: ta, setUpFunction: caVal4), + BenchmarkInfo(name: "Existential.Array.method.1x.Ref1", runFunction: run_Array_method1xRef1, tags: ta, setUpFunction: caRef1), + BenchmarkInfo(name: "Existential.Array.method.1x.Ref2", runFunction: run_Array_method1xRef2, tags: ta, setUpFunction: caRef2), + BenchmarkInfo(name: "Existential.Array.method.1x.Ref3", runFunction: run_Array_method1xRef3, tags: ta, setUpFunction: caRef3), + BenchmarkInfo(name: "Existential.Array.method.1x.Ref4", runFunction: run_Array_method1xRef4, tags: ta, setUpFunction: caRef4), + BenchmarkInfo(name: "Existential.Array.method.1x.Val0", runFunction: run_Array_method1xVal0, tags: ta, setUpFunction: caVal0), + BenchmarkInfo(name: "Existential.Array.method.1x.Val1", runFunction: run_Array_method1xVal1, tags: ta, setUpFunction: caVal1), + BenchmarkInfo(name: "Existential.Array.method.1x.Val2", runFunction: run_Array_method1xVal2, tags: ta, setUpFunction: caVal2), + BenchmarkInfo(name: "Existential.Array.method.1x.Val3", runFunction: run_Array_method1xVal3, tags: ta, setUpFunction: caVal3), + BenchmarkInfo(name: "Existential.Array.method.1x.Val4", runFunction: run_Array_method1xVal4, tags: ta, setUpFunction: caVal4), + BenchmarkInfo(name: "Existential.Array.method.2x.Ref1", runFunction: run_Array_method2xRef1, tags: ta, setUpFunction: caRef1), + BenchmarkInfo(name: "Existential.Array.method.2x.Ref2", runFunction: run_Array_method2xRef2, tags: ta, setUpFunction: caRef2), + BenchmarkInfo(name: "Existential.Array.method.2x.Ref3", runFunction: run_Array_method2xRef3, tags: ta, setUpFunction: caRef3), + BenchmarkInfo(name: "Existential.Array.method.2x.Ref4", runFunction: run_Array_method2xRef4, tags: ta, setUpFunction: caRef4), + BenchmarkInfo(name: "Existential.Array.method.2x.Val0", runFunction: run_Array_method2xVal0, tags: ta, setUpFunction: caVal0), + BenchmarkInfo(name: "Existential.Array.method.2x.Val1", runFunction: run_Array_method2xVal1, tags: ta, setUpFunction: caVal1), + BenchmarkInfo(name: "Existential.Array.method.2x.Val2", runFunction: run_Array_method2xVal2, tags: ta, setUpFunction: caVal2), + BenchmarkInfo(name: "Existential.Array.method.2x.Val3", runFunction: run_Array_method2xVal3, tags: ta, setUpFunction: caVal3), + BenchmarkInfo(name: "Existential.Array.method.2x.Val4", runFunction: run_Array_method2xVal4, tags: ta, setUpFunction: caVal4), + BenchmarkInfo(name: "Existential.Array.Mutating.Ref1", runFunction: run_ArrayMutatingRef1, tags: ta, setUpFunction: caRef1), + BenchmarkInfo(name: "Existential.Array.Mutating.Ref2", runFunction: run_ArrayMutatingRef2, tags: ta, setUpFunction: caRef2), + BenchmarkInfo(name: "Existential.Array.Mutating.Ref3", runFunction: run_ArrayMutatingRef3, tags: ta, setUpFunction: caRef3), + BenchmarkInfo(name: "Existential.Array.Mutating.Ref4", runFunction: run_ArrayMutatingRef4, tags: ta, setUpFunction: caRef4), + BenchmarkInfo(name: "Existential.Array.Mutating.Val0", runFunction: run_ArrayMutatingVal0, tags: ta, setUpFunction: caVal0), + BenchmarkInfo(name: "Existential.Array.Mutating.Val1", runFunction: run_ArrayMutatingVal1, tags: ta, setUpFunction: caVal1), + BenchmarkInfo(name: "Existential.Array.Mutating.Val2", runFunction: run_ArrayMutatingVal2, tags: ta, setUpFunction: caVal2), + BenchmarkInfo(name: "Existential.Array.Mutating.Val3", runFunction: run_ArrayMutatingVal3, tags: ta, setUpFunction: caVal3), + BenchmarkInfo(name: "Existential.Array.Mutating.Val4", runFunction: run_ArrayMutatingVal4, tags: ta, setUpFunction: caVal4), + BenchmarkInfo(name: "Existential.Array.Shift.Ref1", runFunction: run_ArrayShiftRef1, tags: ta, setUpFunction: caRef1), + BenchmarkInfo(name: "Existential.Array.Shift.Ref2", runFunction: run_ArrayShiftRef2, tags: ta, setUpFunction: caRef2), + BenchmarkInfo(name: "Existential.Array.Shift.Ref3", runFunction: run_ArrayShiftRef3, tags: ta, setUpFunction: caRef3), + BenchmarkInfo(name: "Existential.Array.Shift.Ref4", runFunction: run_ArrayShiftRef4, tags: ta, setUpFunction: caRef4), + BenchmarkInfo(name: "Existential.Array.Shift.Val0", runFunction: run_ArrayShiftVal0, tags: ta, setUpFunction: caVal0), + BenchmarkInfo(name: "Existential.Array.Shift.Val1", runFunction: run_ArrayShiftVal1, tags: ta, setUpFunction: caVal1), + BenchmarkInfo(name: "Existential.Array.Shift.Val2", runFunction: run_ArrayShiftVal2, tags: ta, setUpFunction: caVal2), + BenchmarkInfo(name: "Existential.Array.Shift.Val3", runFunction: run_ArrayShiftVal3, tags: ta, setUpFunction: caVal3), + BenchmarkInfo(name: "Existential.Array.Shift.Val4", runFunction: run_ArrayShiftVal4, tags: ta, setUpFunction: caVal4), + BenchmarkInfo(name: "Existential.Array.ConditionalShift.Ref1", runFunction: run_ArrayConditionalShiftRef1, tags: ta, setUpFunction: caRef1), + BenchmarkInfo(name: "Existential.Array.ConditionalShift.Ref2", runFunction: run_ArrayConditionalShiftRef2, tags: ta, setUpFunction: caRef2), + BenchmarkInfo(name: "Existential.Array.ConditionalShift.Ref3", runFunction: run_ArrayConditionalShiftRef3, tags: ta, setUpFunction: caRef3), + BenchmarkInfo(name: "Existential.Array.ConditionalShift.Ref4", runFunction: run_ArrayConditionalShiftRef4, tags: ta, setUpFunction: caRef4), + BenchmarkInfo(name: "Existential.Array.ConditionalShift.Val0", runFunction: run_ArrayConditionalShiftVal0, tags: ta, setUpFunction: caVal0), + BenchmarkInfo(name: "Existential.Array.ConditionalShift.Val1", runFunction: run_ArrayConditionalShiftVal1, tags: ta, setUpFunction: caVal1), + BenchmarkInfo(name: "Existential.Array.ConditionalShift.Val2", runFunction: run_ArrayConditionalShiftVal2, tags: ta, setUpFunction: caVal2), + BenchmarkInfo(name: "Existential.Array.ConditionalShift.Val3", runFunction: run_ArrayConditionalShiftVal3, tags: ta, setUpFunction: caVal3), + BenchmarkInfo(name: "Existential.Array.ConditionalShift.Val4", runFunction: run_ArrayConditionalShiftVal4, tags: ta, setUpFunction: caVal4), ] +// To exclude the setup overhead of existential array initialization, +// these are setup functions that **create array** for each variant type. +var array: [Existential]! +func ca(_: T.Type) { + array = initExistentialArray(withType: T.self, count: 128) +} +func caVal0() { ca(Val0.self) } +func caVal1() { ca(Val1.self) } +func caVal2() { ca(Val2.self) } +func caVal3() { ca(Val3.self) } +func caVal4() { ca(Val4.self) } +func caRef1() { ca(Ref1.self) } +func caRef2() { ca(Ref2.self) } +func caRef3() { ca(Ref3.self) } +func caRef4() { ca(Ref4.self) } +@inline(never) +func grabArray() -> [Existential] { // transfer array ownership to caller + // FIXME: This is causing Illegal Instruction: 4 crash + // defer { array = nil } + // return array + // This doesn't work either: + // let a = array! + // array = nil + // return a + return array! +} + protocol Existential { init() func doIt() -> Bool @@ -374,8 +410,15 @@ func run_MutatingAndNonMutating(withType: T.Type, numberOfTimes } } +func run_Array_init(withType: T.Type, numberOfTimes N: Int) { + + for _ in 0 ..< N * 20 { + blackHole(initExistentialArray(withType: T.self, count: 128)) + } +} + func run_Array_method1x(withType: T.Type, numberOfTimes N: Int) { - let existentialArray = initExistentialArray(withType: T.self, count: 128) + let existentialArray = grabArray() for _ in 0 ..< N * 100 { for elt in existentialArray { if !elt.doIt() { @@ -386,7 +429,7 @@ func run_Array_method1x(withType: T.Type, numberOfTimes N: Int) } func run_Array_method2x(withType: T.Type, numberOfTimes N: Int) { - let existentialArray = initExistentialArray(withType: T.self, count: 128) + let existentialArray = grabArray() for _ in 0 ..< N * 100 { for elt in existentialArray { if !elt.doIt() || !elt.reallyDoIt() { @@ -397,7 +440,7 @@ func run_Array_method2x(withType: T.Type, numberOfTimes N: Int) } func run_ArrayMutating(withType: T.Type, numberOfTimes N: Int) { - var existentialArray = initExistentialArray(withType: T.self, count: 128) + var existentialArray = grabArray() for _ in 0 ..< N * 100 { for i in 0 ..< existentialArray.count { if !existentialArray[i].mutateIt() { @@ -408,7 +451,7 @@ func run_ArrayMutating(withType: T.Type, numberOfTimes N: Int) { } func run_ArrayShift(withType: T.Type, numberOfTimes N: Int) { - var existentialArray = initExistentialArray(withType: T.self, count: 128) + var existentialArray = grabArray() for _ in 0 ..< N * 10 { for i in 0 ..< existentialArray.count-1 { existentialArray.swapAt(i, i+1) @@ -417,7 +460,7 @@ func run_ArrayShift(withType: T.Type, numberOfTimes N: Int) { } func run_ArrayConditionalShift(withType: T.Type, numberOfTimes N: Int) { - var existentialArray = initExistentialArray(withType: T.self, count: 128) + var existentialArray = grabArray() for _ in 0 ..< N * 10 { for i in 0 ..< existentialArray.count-1 { let curr = existentialArray[i] @@ -603,6 +646,35 @@ public func run_MutatingAndNonMutatingRef4(_ N: Int) { run_MutatingAndNonMutating(withType: Ref4.self, numberOfTimes: N) } +// Array.init. +public func run_Array_initVal0(_ N: Int) { + run_Array_init(withType: Val0.self, numberOfTimes: N) +} +public func run_Array_initVal1(_ N: Int) { + run_Array_init(withType: Val1.self, numberOfTimes: N) +} +public func run_Array_initVal2(_ N: Int) { + run_Array_init(withType: Val2.self, numberOfTimes: N) +} +public func run_Array_initVal3(_ N: Int) { + run_Array_init(withType: Val3.self, numberOfTimes: N) +} +public func run_Array_initVal4(_ N: Int) { + run_Array_init(withType: Val4.self, numberOfTimes: N) +} +public func run_Array_initRef1(_ N: Int) { + run_Array_init(withType: Ref1.self, numberOfTimes: N) +} +public func run_Array_initRef2(_ N: Int) { + run_Array_init(withType: Ref2.self, numberOfTimes: N) +} +public func run_Array_initRef3(_ N: Int) { + run_Array_init(withType: Ref3.self, numberOfTimes: N) +} +public func run_Array_initRef4(_ N: Int) { + run_Array_init(withType: Ref4.self, numberOfTimes: N) +} + // Array.method.1x. public func run_Array_method1xVal0(_ N: Int) { run_Array_method1x(withType: Val0.self, numberOfTimes: N) diff --git a/benchmark/single-source/ExistentialPerformance.swift.gyb b/benchmark/single-source/ExistentialPerformance.swift.gyb index c5f3c976948ca..1d096988764f0 100644 --- a/benchmark/single-source/ExistentialPerformance.swift.gyb +++ b/benchmark/single-source/ExistentialPerformance.swift.gyb @@ -23,13 +23,13 @@ let t: [BenchmarkCategory] = [] let ta: [BenchmarkCategory] = [.api, .Array] %{ Setup = """ - let existentialArray = initExistentialArray(withType: T.self, count: 128) let existential = initExistential(withType: T.self) let existential2 = initExistential(withType: T.self) var existential = initExistential(withType: T.self) - var existentialArray = initExistentialArray(withType: T.self, count: 128) -""".splitlines()[1:] -Setup = [Setup[0], Setup[1], '\n'.join(Setup[1:3]), Setup[3], Setup[4]] + let existentialArray = grabArray() + var existentialArray = grabArray() +""".splitlines() +Setup = [Setup[0], Setup[1], '\n'.join(Setup[1:3]), Setup[3], Setup[4], Setup[5]] Workloads = [ ('method.1x', Setup[1], '20_000', """ @@ -63,33 +63,36 @@ Workloads = [ fatalError("expected true") } """), - ('Array.method.1x', Setup[0], '100', """ + ('Array.init', Setup[0], '20', """ + blackHole(initExistentialArray(withType: T.self, count: 128)) +"""), + ('Array.method.1x', Setup[4], '100', """ for elt in existentialArray { if !elt.doIt() { fatalError("expected true") } } """), - ('Array.method.2x', Setup[0], '100', """ + ('Array.method.2x', Setup[4], '100', """ for elt in existentialArray { if !elt.doIt() || !elt.reallyDoIt() { fatalError("expected true") } } """), - ('Array.Mutating', Setup[4], '100', """ + ('Array.Mutating', Setup[5], '100', """ for i in 0 ..< existentialArray.count { if !existentialArray[i].mutateIt() { fatalError("expected true") } } """), - ('Array.Shift', Setup[4], '10', """ + ('Array.Shift', Setup[5], '10', """ for i in 0 ..< existentialArray.count-1 { existentialArray.swapAt(i, i+1) } """), - ('Array.ConditionalShift', Setup[4], '10', """ + ('Array.ConditionalShift', Setup[5], '10', """ for i in 0 ..< existentialArray.count-1 { let curr = existentialArray[i] if curr.doIt() { @@ -121,10 +124,32 @@ public let ExistentialPerformance: [BenchmarkInfo] = [ % for Name in Names: BenchmarkInfo(name: "Existential.${Name}", runFunction: ${ run_function_name(Name)}, tags: ${ - 'ta' if 'Array' in Name else 't'}), + 'ta' if 'Array' in Name else 't'}${ + (', setUpFunction: ca' + Name.split('.')[-1]) if 'Array' in Name else '' }), % end ] +// To exclude the setup overhead of existential array initialization, +// these are setup functions that **create array** for each variant type. +var array: [Existential]! +func ca(_: T.Type) { + array = initExistentialArray(withType: T.self, count: 128) +} +% for Variant in Vals + Refs: +func ca${Variant}() { ca(${Variant}.self) } +% end +@inline(never) +func grabArray() -> [Existential] { // transfer array ownership to caller + // FIXME: This is causing Illegal Instruction: 4 crash + // defer { array = nil } + // return array + // This doesn't work either: + // let a = array! + // array = nil + // return a + return array! +} + protocol Existential { init() func doIt() -> Bool From 6b29523f0c5c83d5228d2a85a8a25e43582f93fb Mon Sep 17 00:00:00 2001 From: Pavol Vaskovic Date: Sat, 17 Nov 2018 00:20:02 +0100 Subject: [PATCH 07/12] [benchmark] Gardening: 80 col Existential Break up BenchmarkInfo into 2 lines to fit 80 column line limit. --- .../ExistentialPerformance.swift | 334 ++++++++++++------ .../ExistentialPerformance.swift.gyb | 13 +- 2 files changed, 232 insertions(+), 115 deletions(-) diff --git a/benchmark/single-source/ExistentialPerformance.swift b/benchmark/single-source/ExistentialPerformance.swift index c05e69c918a5b..a4fb5762bc02b 100644 --- a/benchmark/single-source/ExistentialPerformance.swift +++ b/benchmark/single-source/ExistentialPerformance.swift @@ -20,115 +20,224 @@ import TestsUtils let t: [BenchmarkCategory] = [] let ta: [BenchmarkCategory] = [.api, .Array] + public let ExistentialPerformance: [BenchmarkInfo] = [ - BenchmarkInfo(name: "Existential.method.1x.Ref1", runFunction: run_method1xRef1, tags: t), - BenchmarkInfo(name: "Existential.method.1x.Ref2", runFunction: run_method1xRef2, tags: t), - BenchmarkInfo(name: "Existential.method.1x.Ref3", runFunction: run_method1xRef3, tags: t), - BenchmarkInfo(name: "Existential.method.1x.Ref4", runFunction: run_method1xRef4, tags: t), - BenchmarkInfo(name: "Existential.method.1x.Val0", runFunction: run_method1xVal0, tags: t), - BenchmarkInfo(name: "Existential.method.1x.Val1", runFunction: run_method1xVal1, tags: t), - BenchmarkInfo(name: "Existential.method.1x.Val2", runFunction: run_method1xVal2, tags: t), - BenchmarkInfo(name: "Existential.method.1x.Val3", runFunction: run_method1xVal3, tags: t), - BenchmarkInfo(name: "Existential.method.1x.Val4", runFunction: run_method1xVal4, tags: t), - BenchmarkInfo(name: "Existential.method.2x.Ref1", runFunction: run_method2xRef1, tags: t), - BenchmarkInfo(name: "Existential.method.2x.Ref2", runFunction: run_method2xRef2, tags: t), - BenchmarkInfo(name: "Existential.method.2x.Ref3", runFunction: run_method2xRef3, tags: t), - BenchmarkInfo(name: "Existential.method.2x.Ref4", runFunction: run_method2xRef4, tags: t), - BenchmarkInfo(name: "Existential.method.2x.Val0", runFunction: run_method2xVal0, tags: t), - BenchmarkInfo(name: "Existential.method.2x.Val1", runFunction: run_method2xVal1, tags: t), - BenchmarkInfo(name: "Existential.method.2x.Val2", runFunction: run_method2xVal2, tags: t), - BenchmarkInfo(name: "Existential.method.2x.Val3", runFunction: run_method2xVal3, tags: t), - BenchmarkInfo(name: "Existential.method.2x.Val4", runFunction: run_method2xVal4, tags: t), - BenchmarkInfo(name: "Existential.Pass.method.1x.Ref1", runFunction: run_Pass_method1xRef1, tags: t), - BenchmarkInfo(name: "Existential.Pass.method.1x.Ref2", runFunction: run_Pass_method1xRef2, tags: t), - BenchmarkInfo(name: "Existential.Pass.method.1x.Ref3", runFunction: run_Pass_method1xRef3, tags: t), - BenchmarkInfo(name: "Existential.Pass.method.1x.Ref4", runFunction: run_Pass_method1xRef4, tags: t), - BenchmarkInfo(name: "Existential.Pass.method.1x.Val0", runFunction: run_Pass_method1xVal0, tags: t), - BenchmarkInfo(name: "Existential.Pass.method.1x.Val1", runFunction: run_Pass_method1xVal1, tags: t), - BenchmarkInfo(name: "Existential.Pass.method.1x.Val2", runFunction: run_Pass_method1xVal2, tags: t), - BenchmarkInfo(name: "Existential.Pass.method.1x.Val3", runFunction: run_Pass_method1xVal3, tags: t), - BenchmarkInfo(name: "Existential.Pass.method.1x.Val4", runFunction: run_Pass_method1xVal4, tags: t), - BenchmarkInfo(name: "Existential.Pass.method.2x.Ref1", runFunction: run_Pass_method2xRef1, tags: t), - BenchmarkInfo(name: "Existential.Pass.method.2x.Ref2", runFunction: run_Pass_method2xRef2, tags: t), - BenchmarkInfo(name: "Existential.Pass.method.2x.Ref3", runFunction: run_Pass_method2xRef3, tags: t), - BenchmarkInfo(name: "Existential.Pass.method.2x.Ref4", runFunction: run_Pass_method2xRef4, tags: t), - BenchmarkInfo(name: "Existential.Pass.method.2x.Val0", runFunction: run_Pass_method2xVal0, tags: t), - BenchmarkInfo(name: "Existential.Pass.method.2x.Val1", runFunction: run_Pass_method2xVal1, tags: t), - BenchmarkInfo(name: "Existential.Pass.method.2x.Val2", runFunction: run_Pass_method2xVal2, tags: t), - BenchmarkInfo(name: "Existential.Pass.method.2x.Val3", runFunction: run_Pass_method2xVal3, tags: t), - BenchmarkInfo(name: "Existential.Pass.method.2x.Val4", runFunction: run_Pass_method2xVal4, tags: t), - BenchmarkInfo(name: "Existential.Mutating.Ref1", runFunction: run_MutatingRef1, tags: t), - BenchmarkInfo(name: "Existential.Mutating.Ref2", runFunction: run_MutatingRef2, tags: t), - BenchmarkInfo(name: "Existential.Mutating.Ref3", runFunction: run_MutatingRef3, tags: t), - BenchmarkInfo(name: "Existential.Mutating.Ref4", runFunction: run_MutatingRef4, tags: t), - BenchmarkInfo(name: "Existential.Mutating.Val0", runFunction: run_MutatingVal0, tags: t), - BenchmarkInfo(name: "Existential.Mutating.Val1", runFunction: run_MutatingVal1, tags: t), - BenchmarkInfo(name: "Existential.Mutating.Val2", runFunction: run_MutatingVal2, tags: t), - BenchmarkInfo(name: "Existential.Mutating.Val3", runFunction: run_MutatingVal3, tags: t), - BenchmarkInfo(name: "Existential.Mutating.Val4", runFunction: run_MutatingVal4, tags: t), - BenchmarkInfo(name: "Existential.MutatingAndNonMutating.Ref1", runFunction: run_MutatingAndNonMutatingRef1, tags: t), - BenchmarkInfo(name: "Existential.MutatingAndNonMutating.Ref2", runFunction: run_MutatingAndNonMutatingRef2, tags: t), - BenchmarkInfo(name: "Existential.MutatingAndNonMutating.Ref3", runFunction: run_MutatingAndNonMutatingRef3, tags: t), - BenchmarkInfo(name: "Existential.MutatingAndNonMutating.Ref4", runFunction: run_MutatingAndNonMutatingRef4, tags: t), - BenchmarkInfo(name: "Existential.MutatingAndNonMutating.Val0", runFunction: run_MutatingAndNonMutatingVal0, tags: t), - BenchmarkInfo(name: "Existential.MutatingAndNonMutating.Val1", runFunction: run_MutatingAndNonMutatingVal1, tags: t), - BenchmarkInfo(name: "Existential.MutatingAndNonMutating.Val2", runFunction: run_MutatingAndNonMutatingVal2, tags: t), - BenchmarkInfo(name: "Existential.MutatingAndNonMutating.Val3", runFunction: run_MutatingAndNonMutatingVal3, tags: t), - BenchmarkInfo(name: "Existential.MutatingAndNonMutating.Val4", runFunction: run_MutatingAndNonMutatingVal4, tags: t), - BenchmarkInfo(name: "Existential.Array.init.Ref1", runFunction: run_Array_initRef1, tags: ta, setUpFunction: caRef1), - BenchmarkInfo(name: "Existential.Array.init.Ref2", runFunction: run_Array_initRef2, tags: ta, setUpFunction: caRef2), - BenchmarkInfo(name: "Existential.Array.init.Ref3", runFunction: run_Array_initRef3, tags: ta, setUpFunction: caRef3), - BenchmarkInfo(name: "Existential.Array.init.Ref4", runFunction: run_Array_initRef4, tags: ta, setUpFunction: caRef4), - BenchmarkInfo(name: "Existential.Array.init.Val0", runFunction: run_Array_initVal0, tags: ta, setUpFunction: caVal0), - BenchmarkInfo(name: "Existential.Array.init.Val1", runFunction: run_Array_initVal1, tags: ta, setUpFunction: caVal1), - BenchmarkInfo(name: "Existential.Array.init.Val2", runFunction: run_Array_initVal2, tags: ta, setUpFunction: caVal2), - BenchmarkInfo(name: "Existential.Array.init.Val3", runFunction: run_Array_initVal3, tags: ta, setUpFunction: caVal3), - BenchmarkInfo(name: "Existential.Array.init.Val4", runFunction: run_Array_initVal4, tags: ta, setUpFunction: caVal4), - BenchmarkInfo(name: "Existential.Array.method.1x.Ref1", runFunction: run_Array_method1xRef1, tags: ta, setUpFunction: caRef1), - BenchmarkInfo(name: "Existential.Array.method.1x.Ref2", runFunction: run_Array_method1xRef2, tags: ta, setUpFunction: caRef2), - BenchmarkInfo(name: "Existential.Array.method.1x.Ref3", runFunction: run_Array_method1xRef3, tags: ta, setUpFunction: caRef3), - BenchmarkInfo(name: "Existential.Array.method.1x.Ref4", runFunction: run_Array_method1xRef4, tags: ta, setUpFunction: caRef4), - BenchmarkInfo(name: "Existential.Array.method.1x.Val0", runFunction: run_Array_method1xVal0, tags: ta, setUpFunction: caVal0), - BenchmarkInfo(name: "Existential.Array.method.1x.Val1", runFunction: run_Array_method1xVal1, tags: ta, setUpFunction: caVal1), - BenchmarkInfo(name: "Existential.Array.method.1x.Val2", runFunction: run_Array_method1xVal2, tags: ta, setUpFunction: caVal2), - BenchmarkInfo(name: "Existential.Array.method.1x.Val3", runFunction: run_Array_method1xVal3, tags: ta, setUpFunction: caVal3), - BenchmarkInfo(name: "Existential.Array.method.1x.Val4", runFunction: run_Array_method1xVal4, tags: ta, setUpFunction: caVal4), - BenchmarkInfo(name: "Existential.Array.method.2x.Ref1", runFunction: run_Array_method2xRef1, tags: ta, setUpFunction: caRef1), - BenchmarkInfo(name: "Existential.Array.method.2x.Ref2", runFunction: run_Array_method2xRef2, tags: ta, setUpFunction: caRef2), - BenchmarkInfo(name: "Existential.Array.method.2x.Ref3", runFunction: run_Array_method2xRef3, tags: ta, setUpFunction: caRef3), - BenchmarkInfo(name: "Existential.Array.method.2x.Ref4", runFunction: run_Array_method2xRef4, tags: ta, setUpFunction: caRef4), - BenchmarkInfo(name: "Existential.Array.method.2x.Val0", runFunction: run_Array_method2xVal0, tags: ta, setUpFunction: caVal0), - BenchmarkInfo(name: "Existential.Array.method.2x.Val1", runFunction: run_Array_method2xVal1, tags: ta, setUpFunction: caVal1), - BenchmarkInfo(name: "Existential.Array.method.2x.Val2", runFunction: run_Array_method2xVal2, tags: ta, setUpFunction: caVal2), - BenchmarkInfo(name: "Existential.Array.method.2x.Val3", runFunction: run_Array_method2xVal3, tags: ta, setUpFunction: caVal3), - BenchmarkInfo(name: "Existential.Array.method.2x.Val4", runFunction: run_Array_method2xVal4, tags: ta, setUpFunction: caVal4), - BenchmarkInfo(name: "Existential.Array.Mutating.Ref1", runFunction: run_ArrayMutatingRef1, tags: ta, setUpFunction: caRef1), - BenchmarkInfo(name: "Existential.Array.Mutating.Ref2", runFunction: run_ArrayMutatingRef2, tags: ta, setUpFunction: caRef2), - BenchmarkInfo(name: "Existential.Array.Mutating.Ref3", runFunction: run_ArrayMutatingRef3, tags: ta, setUpFunction: caRef3), - BenchmarkInfo(name: "Existential.Array.Mutating.Ref4", runFunction: run_ArrayMutatingRef4, tags: ta, setUpFunction: caRef4), - BenchmarkInfo(name: "Existential.Array.Mutating.Val0", runFunction: run_ArrayMutatingVal0, tags: ta, setUpFunction: caVal0), - BenchmarkInfo(name: "Existential.Array.Mutating.Val1", runFunction: run_ArrayMutatingVal1, tags: ta, setUpFunction: caVal1), - BenchmarkInfo(name: "Existential.Array.Mutating.Val2", runFunction: run_ArrayMutatingVal2, tags: ta, setUpFunction: caVal2), - BenchmarkInfo(name: "Existential.Array.Mutating.Val3", runFunction: run_ArrayMutatingVal3, tags: ta, setUpFunction: caVal3), - BenchmarkInfo(name: "Existential.Array.Mutating.Val4", runFunction: run_ArrayMutatingVal4, tags: ta, setUpFunction: caVal4), - BenchmarkInfo(name: "Existential.Array.Shift.Ref1", runFunction: run_ArrayShiftRef1, tags: ta, setUpFunction: caRef1), - BenchmarkInfo(name: "Existential.Array.Shift.Ref2", runFunction: run_ArrayShiftRef2, tags: ta, setUpFunction: caRef2), - BenchmarkInfo(name: "Existential.Array.Shift.Ref3", runFunction: run_ArrayShiftRef3, tags: ta, setUpFunction: caRef3), - BenchmarkInfo(name: "Existential.Array.Shift.Ref4", runFunction: run_ArrayShiftRef4, tags: ta, setUpFunction: caRef4), - BenchmarkInfo(name: "Existential.Array.Shift.Val0", runFunction: run_ArrayShiftVal0, tags: ta, setUpFunction: caVal0), - BenchmarkInfo(name: "Existential.Array.Shift.Val1", runFunction: run_ArrayShiftVal1, tags: ta, setUpFunction: caVal1), - BenchmarkInfo(name: "Existential.Array.Shift.Val2", runFunction: run_ArrayShiftVal2, tags: ta, setUpFunction: caVal2), - BenchmarkInfo(name: "Existential.Array.Shift.Val3", runFunction: run_ArrayShiftVal3, tags: ta, setUpFunction: caVal3), - BenchmarkInfo(name: "Existential.Array.Shift.Val4", runFunction: run_ArrayShiftVal4, tags: ta, setUpFunction: caVal4), - BenchmarkInfo(name: "Existential.Array.ConditionalShift.Ref1", runFunction: run_ArrayConditionalShiftRef1, tags: ta, setUpFunction: caRef1), - BenchmarkInfo(name: "Existential.Array.ConditionalShift.Ref2", runFunction: run_ArrayConditionalShiftRef2, tags: ta, setUpFunction: caRef2), - BenchmarkInfo(name: "Existential.Array.ConditionalShift.Ref3", runFunction: run_ArrayConditionalShiftRef3, tags: ta, setUpFunction: caRef3), - BenchmarkInfo(name: "Existential.Array.ConditionalShift.Ref4", runFunction: run_ArrayConditionalShiftRef4, tags: ta, setUpFunction: caRef4), - BenchmarkInfo(name: "Existential.Array.ConditionalShift.Val0", runFunction: run_ArrayConditionalShiftVal0, tags: ta, setUpFunction: caVal0), - BenchmarkInfo(name: "Existential.Array.ConditionalShift.Val1", runFunction: run_ArrayConditionalShiftVal1, tags: ta, setUpFunction: caVal1), - BenchmarkInfo(name: "Existential.Array.ConditionalShift.Val2", runFunction: run_ArrayConditionalShiftVal2, tags: ta, setUpFunction: caVal2), - BenchmarkInfo(name: "Existential.Array.ConditionalShift.Val3", runFunction: run_ArrayConditionalShiftVal3, tags: ta, setUpFunction: caVal3), - BenchmarkInfo(name: "Existential.Array.ConditionalShift.Val4", runFunction: run_ArrayConditionalShiftVal4, tags: ta, setUpFunction: caVal4), + BenchmarkInfo(name: "Existential.method.1x.Ref1", + runFunction: run_method1xRef1, tags: t), + BenchmarkInfo(name: "Existential.method.1x.Ref2", + runFunction: run_method1xRef2, tags: t), + BenchmarkInfo(name: "Existential.method.1x.Ref3", + runFunction: run_method1xRef3, tags: t), + BenchmarkInfo(name: "Existential.method.1x.Ref4", + runFunction: run_method1xRef4, tags: t), + BenchmarkInfo(name: "Existential.method.1x.Val0", + runFunction: run_method1xVal0, tags: t), + BenchmarkInfo(name: "Existential.method.1x.Val1", + runFunction: run_method1xVal1, tags: t), + BenchmarkInfo(name: "Existential.method.1x.Val2", + runFunction: run_method1xVal2, tags: t), + BenchmarkInfo(name: "Existential.method.1x.Val3", + runFunction: run_method1xVal3, tags: t), + BenchmarkInfo(name: "Existential.method.1x.Val4", + runFunction: run_method1xVal4, tags: t), + BenchmarkInfo(name: "Existential.method.2x.Ref1", + runFunction: run_method2xRef1, tags: t), + BenchmarkInfo(name: "Existential.method.2x.Ref2", + runFunction: run_method2xRef2, tags: t), + BenchmarkInfo(name: "Existential.method.2x.Ref3", + runFunction: run_method2xRef3, tags: t), + BenchmarkInfo(name: "Existential.method.2x.Ref4", + runFunction: run_method2xRef4, tags: t), + BenchmarkInfo(name: "Existential.method.2x.Val0", + runFunction: run_method2xVal0, tags: t), + BenchmarkInfo(name: "Existential.method.2x.Val1", + runFunction: run_method2xVal1, tags: t), + BenchmarkInfo(name: "Existential.method.2x.Val2", + runFunction: run_method2xVal2, tags: t), + BenchmarkInfo(name: "Existential.method.2x.Val3", + runFunction: run_method2xVal3, tags: t), + BenchmarkInfo(name: "Existential.method.2x.Val4", + runFunction: run_method2xVal4, tags: t), + BenchmarkInfo(name: "Existential.Pass.method.1x.Ref1", + runFunction: run_Pass_method1xRef1, tags: t), + BenchmarkInfo(name: "Existential.Pass.method.1x.Ref2", + runFunction: run_Pass_method1xRef2, tags: t), + BenchmarkInfo(name: "Existential.Pass.method.1x.Ref3", + runFunction: run_Pass_method1xRef3, tags: t), + BenchmarkInfo(name: "Existential.Pass.method.1x.Ref4", + runFunction: run_Pass_method1xRef4, tags: t), + BenchmarkInfo(name: "Existential.Pass.method.1x.Val0", + runFunction: run_Pass_method1xVal0, tags: t), + BenchmarkInfo(name: "Existential.Pass.method.1x.Val1", + runFunction: run_Pass_method1xVal1, tags: t), + BenchmarkInfo(name: "Existential.Pass.method.1x.Val2", + runFunction: run_Pass_method1xVal2, tags: t), + BenchmarkInfo(name: "Existential.Pass.method.1x.Val3", + runFunction: run_Pass_method1xVal3, tags: t), + BenchmarkInfo(name: "Existential.Pass.method.1x.Val4", + runFunction: run_Pass_method1xVal4, tags: t), + BenchmarkInfo(name: "Existential.Pass.method.2x.Ref1", + runFunction: run_Pass_method2xRef1, tags: t), + BenchmarkInfo(name: "Existential.Pass.method.2x.Ref2", + runFunction: run_Pass_method2xRef2, tags: t), + BenchmarkInfo(name: "Existential.Pass.method.2x.Ref3", + runFunction: run_Pass_method2xRef3, tags: t), + BenchmarkInfo(name: "Existential.Pass.method.2x.Ref4", + runFunction: run_Pass_method2xRef4, tags: t), + BenchmarkInfo(name: "Existential.Pass.method.2x.Val0", + runFunction: run_Pass_method2xVal0, tags: t), + BenchmarkInfo(name: "Existential.Pass.method.2x.Val1", + runFunction: run_Pass_method2xVal1, tags: t), + BenchmarkInfo(name: "Existential.Pass.method.2x.Val2", + runFunction: run_Pass_method2xVal2, tags: t), + BenchmarkInfo(name: "Existential.Pass.method.2x.Val3", + runFunction: run_Pass_method2xVal3, tags: t), + BenchmarkInfo(name: "Existential.Pass.method.2x.Val4", + runFunction: run_Pass_method2xVal4, tags: t), + BenchmarkInfo(name: "Existential.Mutating.Ref1", + runFunction: run_MutatingRef1, tags: t), + BenchmarkInfo(name: "Existential.Mutating.Ref2", + runFunction: run_MutatingRef2, tags: t), + BenchmarkInfo(name: "Existential.Mutating.Ref3", + runFunction: run_MutatingRef3, tags: t), + BenchmarkInfo(name: "Existential.Mutating.Ref4", + runFunction: run_MutatingRef4, tags: t), + BenchmarkInfo(name: "Existential.Mutating.Val0", + runFunction: run_MutatingVal0, tags: t), + BenchmarkInfo(name: "Existential.Mutating.Val1", + runFunction: run_MutatingVal1, tags: t), + BenchmarkInfo(name: "Existential.Mutating.Val2", + runFunction: run_MutatingVal2, tags: t), + BenchmarkInfo(name: "Existential.Mutating.Val3", + runFunction: run_MutatingVal3, tags: t), + BenchmarkInfo(name: "Existential.Mutating.Val4", + runFunction: run_MutatingVal4, tags: t), + BenchmarkInfo(name: "Existential.MutatingAndNonMutating.Ref1", + runFunction: run_MutatingAndNonMutatingRef1, tags: t), + BenchmarkInfo(name: "Existential.MutatingAndNonMutating.Ref2", + runFunction: run_MutatingAndNonMutatingRef2, tags: t), + BenchmarkInfo(name: "Existential.MutatingAndNonMutating.Ref3", + runFunction: run_MutatingAndNonMutatingRef3, tags: t), + BenchmarkInfo(name: "Existential.MutatingAndNonMutating.Ref4", + runFunction: run_MutatingAndNonMutatingRef4, tags: t), + BenchmarkInfo(name: "Existential.MutatingAndNonMutating.Val0", + runFunction: run_MutatingAndNonMutatingVal0, tags: t), + BenchmarkInfo(name: "Existential.MutatingAndNonMutating.Val1", + runFunction: run_MutatingAndNonMutatingVal1, tags: t), + BenchmarkInfo(name: "Existential.MutatingAndNonMutating.Val2", + runFunction: run_MutatingAndNonMutatingVal2, tags: t), + BenchmarkInfo(name: "Existential.MutatingAndNonMutating.Val3", + runFunction: run_MutatingAndNonMutatingVal3, tags: t), + BenchmarkInfo(name: "Existential.MutatingAndNonMutating.Val4", + runFunction: run_MutatingAndNonMutatingVal4, tags: t), + BenchmarkInfo(name: "Existential.Array.init.Ref1", + runFunction: run_Array_initRef1, tags: ta, setUpFunction: caRef1), + BenchmarkInfo(name: "Existential.Array.init.Ref2", + runFunction: run_Array_initRef2, tags: ta, setUpFunction: caRef2), + BenchmarkInfo(name: "Existential.Array.init.Ref3", + runFunction: run_Array_initRef3, tags: ta, setUpFunction: caRef3), + BenchmarkInfo(name: "Existential.Array.init.Ref4", + runFunction: run_Array_initRef4, tags: ta, setUpFunction: caRef4), + BenchmarkInfo(name: "Existential.Array.init.Val0", + runFunction: run_Array_initVal0, tags: ta, setUpFunction: caVal0), + BenchmarkInfo(name: "Existential.Array.init.Val1", + runFunction: run_Array_initVal1, tags: ta, setUpFunction: caVal1), + BenchmarkInfo(name: "Existential.Array.init.Val2", + runFunction: run_Array_initVal2, tags: ta, setUpFunction: caVal2), + BenchmarkInfo(name: "Existential.Array.init.Val3", + runFunction: run_Array_initVal3, tags: ta, setUpFunction: caVal3), + BenchmarkInfo(name: "Existential.Array.init.Val4", + runFunction: run_Array_initVal4, tags: ta, setUpFunction: caVal4), + BenchmarkInfo(name: "Existential.Array.method.1x.Ref1", + runFunction: run_Array_method1xRef1, tags: ta, setUpFunction: caRef1), + BenchmarkInfo(name: "Existential.Array.method.1x.Ref2", + runFunction: run_Array_method1xRef2, tags: ta, setUpFunction: caRef2), + BenchmarkInfo(name: "Existential.Array.method.1x.Ref3", + runFunction: run_Array_method1xRef3, tags: ta, setUpFunction: caRef3), + BenchmarkInfo(name: "Existential.Array.method.1x.Ref4", + runFunction: run_Array_method1xRef4, tags: ta, setUpFunction: caRef4), + BenchmarkInfo(name: "Existential.Array.method.1x.Val0", + runFunction: run_Array_method1xVal0, tags: ta, setUpFunction: caVal0), + BenchmarkInfo(name: "Existential.Array.method.1x.Val1", + runFunction: run_Array_method1xVal1, tags: ta, setUpFunction: caVal1), + BenchmarkInfo(name: "Existential.Array.method.1x.Val2", + runFunction: run_Array_method1xVal2, tags: ta, setUpFunction: caVal2), + BenchmarkInfo(name: "Existential.Array.method.1x.Val3", + runFunction: run_Array_method1xVal3, tags: ta, setUpFunction: caVal3), + BenchmarkInfo(name: "Existential.Array.method.1x.Val4", + runFunction: run_Array_method1xVal4, tags: ta, setUpFunction: caVal4), + BenchmarkInfo(name: "Existential.Array.method.2x.Ref1", + runFunction: run_Array_method2xRef1, tags: ta, setUpFunction: caRef1), + BenchmarkInfo(name: "Existential.Array.method.2x.Ref2", + runFunction: run_Array_method2xRef2, tags: ta, setUpFunction: caRef2), + BenchmarkInfo(name: "Existential.Array.method.2x.Ref3", + runFunction: run_Array_method2xRef3, tags: ta, setUpFunction: caRef3), + BenchmarkInfo(name: "Existential.Array.method.2x.Ref4", + runFunction: run_Array_method2xRef4, tags: ta, setUpFunction: caRef4), + BenchmarkInfo(name: "Existential.Array.method.2x.Val0", + runFunction: run_Array_method2xVal0, tags: ta, setUpFunction: caVal0), + BenchmarkInfo(name: "Existential.Array.method.2x.Val1", + runFunction: run_Array_method2xVal1, tags: ta, setUpFunction: caVal1), + BenchmarkInfo(name: "Existential.Array.method.2x.Val2", + runFunction: run_Array_method2xVal2, tags: ta, setUpFunction: caVal2), + BenchmarkInfo(name: "Existential.Array.method.2x.Val3", + runFunction: run_Array_method2xVal3, tags: ta, setUpFunction: caVal3), + BenchmarkInfo(name: "Existential.Array.method.2x.Val4", + runFunction: run_Array_method2xVal4, tags: ta, setUpFunction: caVal4), + BenchmarkInfo(name: "Existential.Array.Mutating.Ref1", + runFunction: run_ArrayMutatingRef1, tags: ta, setUpFunction: caRef1), + BenchmarkInfo(name: "Existential.Array.Mutating.Ref2", + runFunction: run_ArrayMutatingRef2, tags: ta, setUpFunction: caRef2), + BenchmarkInfo(name: "Existential.Array.Mutating.Ref3", + runFunction: run_ArrayMutatingRef3, tags: ta, setUpFunction: caRef3), + BenchmarkInfo(name: "Existential.Array.Mutating.Ref4", + runFunction: run_ArrayMutatingRef4, tags: ta, setUpFunction: caRef4), + BenchmarkInfo(name: "Existential.Array.Mutating.Val0", + runFunction: run_ArrayMutatingVal0, tags: ta, setUpFunction: caVal0), + BenchmarkInfo(name: "Existential.Array.Mutating.Val1", + runFunction: run_ArrayMutatingVal1, tags: ta, setUpFunction: caVal1), + BenchmarkInfo(name: "Existential.Array.Mutating.Val2", + runFunction: run_ArrayMutatingVal2, tags: ta, setUpFunction: caVal2), + BenchmarkInfo(name: "Existential.Array.Mutating.Val3", + runFunction: run_ArrayMutatingVal3, tags: ta, setUpFunction: caVal3), + BenchmarkInfo(name: "Existential.Array.Mutating.Val4", + runFunction: run_ArrayMutatingVal4, tags: ta, setUpFunction: caVal4), + BenchmarkInfo(name: "Existential.Array.Shift.Ref1", + runFunction: run_ArrayShiftRef1, tags: ta, setUpFunction: caRef1), + BenchmarkInfo(name: "Existential.Array.Shift.Ref2", + runFunction: run_ArrayShiftRef2, tags: ta, setUpFunction: caRef2), + BenchmarkInfo(name: "Existential.Array.Shift.Ref3", + runFunction: run_ArrayShiftRef3, tags: ta, setUpFunction: caRef3), + BenchmarkInfo(name: "Existential.Array.Shift.Ref4", + runFunction: run_ArrayShiftRef4, tags: ta, setUpFunction: caRef4), + BenchmarkInfo(name: "Existential.Array.Shift.Val0", + runFunction: run_ArrayShiftVal0, tags: ta, setUpFunction: caVal0), + BenchmarkInfo(name: "Existential.Array.Shift.Val1", + runFunction: run_ArrayShiftVal1, tags: ta, setUpFunction: caVal1), + BenchmarkInfo(name: "Existential.Array.Shift.Val2", + runFunction: run_ArrayShiftVal2, tags: ta, setUpFunction: caVal2), + BenchmarkInfo(name: "Existential.Array.Shift.Val3", + runFunction: run_ArrayShiftVal3, tags: ta, setUpFunction: caVal3), + BenchmarkInfo(name: "Existential.Array.Shift.Val4", + runFunction: run_ArrayShiftVal4, tags: ta, setUpFunction: caVal4), + BenchmarkInfo(name: "Existential.Array.ConditionalShift.Ref1", + runFunction: run_ArrayConditionalShiftRef1, tags: ta, setUpFunction: caRef1), + BenchmarkInfo(name: "Existential.Array.ConditionalShift.Ref2", + runFunction: run_ArrayConditionalShiftRef2, tags: ta, setUpFunction: caRef2), + BenchmarkInfo(name: "Existential.Array.ConditionalShift.Ref3", + runFunction: run_ArrayConditionalShiftRef3, tags: ta, setUpFunction: caRef3), + BenchmarkInfo(name: "Existential.Array.ConditionalShift.Ref4", + runFunction: run_ArrayConditionalShiftRef4, tags: ta, setUpFunction: caRef4), + BenchmarkInfo(name: "Existential.Array.ConditionalShift.Val0", + runFunction: run_ArrayConditionalShiftVal0, tags: ta, setUpFunction: caVal0), + BenchmarkInfo(name: "Existential.Array.ConditionalShift.Val1", + runFunction: run_ArrayConditionalShiftVal1, tags: ta, setUpFunction: caVal1), + BenchmarkInfo(name: "Existential.Array.ConditionalShift.Val2", + runFunction: run_ArrayConditionalShiftVal2, tags: ta, setUpFunction: caVal2), + BenchmarkInfo(name: "Existential.Array.ConditionalShift.Val3", + runFunction: run_ArrayConditionalShiftVal3, tags: ta, setUpFunction: caVal3), + BenchmarkInfo(name: "Existential.Array.ConditionalShift.Val4", + runFunction: run_ArrayConditionalShiftVal4, tags: ta, setUpFunction: caVal4), ] // To exclude the setup overhead of existential array initialization, @@ -339,17 +448,20 @@ func initExistential(withType: T.Type) -> Existential { } @inline(never) -func initExistentialArray(withType: T.Type, count c: Int) -> [Existential] { +func initExistentialArray(withType: T.Type, count c: Int) + -> [Existential] { return [T](repeating: T(), count: c) } @inline(never) -func passExistentialTwiceOneMethodCall(_ e0: Existential, _ e1: Existential) -> Bool { +func passExistentialTwiceOneMethodCall(_ e0: Existential, _ e1: Existential) + -> Bool { return e0.doIt() && e1.doIt() } @inline(never) -func passExistentialTwiceTwoMethodCalls(_ e0: Existential, _ e1: Existential) -> Bool { +func passExistentialTwiceTwoMethodCalls(_ e0: Existential, _ e1: Existential) + -> Bool { return e0.doIt() && e1.doIt() && e0.reallyDoIt() && e1.reallyDoIt() } diff --git a/benchmark/single-source/ExistentialPerformance.swift.gyb b/benchmark/single-source/ExistentialPerformance.swift.gyb index 1d096988764f0..cb36f16edf1c5 100644 --- a/benchmark/single-source/ExistentialPerformance.swift.gyb +++ b/benchmark/single-source/ExistentialPerformance.swift.gyb @@ -21,6 +21,7 @@ import TestsUtils let t: [BenchmarkCategory] = [] let ta: [BenchmarkCategory] = [.api, .Array] + %{ Setup = """ let existential = initExistential(withType: T.self) @@ -122,7 +123,8 @@ def run_function_name(benchmark_name): }% public let ExistentialPerformance: [BenchmarkInfo] = [ % for Name in Names: - BenchmarkInfo(name: "Existential.${Name}", runFunction: ${ + BenchmarkInfo(name: "Existential.${Name}", + runFunction: ${ run_function_name(Name)}, tags: ${ 'ta' if 'Array' in Name else 't'}${ (', setUpFunction: ca' + Name.split('.')[-1]) if 'Array' in Name else '' }), @@ -224,17 +226,20 @@ func initExistential(withType: T.Type) -> Existential { } @inline(never) -func initExistentialArray(withType: T.Type, count c: Int) -> [Existential] { +func initExistentialArray(withType: T.Type, count c: Int) + -> [Existential] { return [T](repeating: T(), count: c) } @inline(never) -func passExistentialTwiceOneMethodCall(_ e0: Existential, _ e1: Existential) -> Bool { +func passExistentialTwiceOneMethodCall(_ e0: Existential, _ e1: Existential) + -> Bool { return e0.doIt() && e1.doIt() } @inline(never) -func passExistentialTwiceTwoMethodCalls(_ e0: Existential, _ e1: Existential) -> Bool { +func passExistentialTwiceTwoMethodCalls(_ e0: Existential, _ e1: Existential) + -> Bool { return e0.doIt() && e1.doIt() && e0.reallyDoIt() && e1.reallyDoIt() } % for (name, setup, multiple, workload) in Workloads: From 5ad2698799e86c4f9739a7b5e59b4bb89d565d0a Mon Sep 17 00:00:00 2001 From: Pavol Vaskovic Date: Sat, 17 Nov 2018 00:32:24 +0100 Subject: [PATCH 08/12] [benchmark] Refactor: type independent variants MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Benchmarks from Array group (except the `init`) don’t use the `withType` parameter from the `run_` function anymore. The type specific variation is taken care of in the `BenchmarkInfo`, since the `existentialArray` with appropriate type is created by the `setUpFunction`. This means we can reuse the same non-generic `run_ ` function for the whole group and eliminate all the specialized `runFunction` variants. This eliminates 144 lines of boilerplate. --- .../ExistentialPerformance.swift | 277 +++++------------- .../ExistentialPerformance.swift.gyb | 38 ++- 2 files changed, 91 insertions(+), 224 deletions(-) diff --git a/benchmark/single-source/ExistentialPerformance.swift b/benchmark/single-source/ExistentialPerformance.swift index a4fb5762bc02b..7d42a5b9b5b6f 100644 --- a/benchmark/single-source/ExistentialPerformance.swift +++ b/benchmark/single-source/ExistentialPerformance.swift @@ -131,113 +131,113 @@ public let ExistentialPerformance: [BenchmarkInfo] = [ BenchmarkInfo(name: "Existential.MutatingAndNonMutating.Val4", runFunction: run_MutatingAndNonMutatingVal4, tags: t), BenchmarkInfo(name: "Existential.Array.init.Ref1", - runFunction: run_Array_initRef1, tags: ta, setUpFunction: caRef1), + runFunction: run_Array_initRef1, tags: ta), BenchmarkInfo(name: "Existential.Array.init.Ref2", - runFunction: run_Array_initRef2, tags: ta, setUpFunction: caRef2), + runFunction: run_Array_initRef2, tags: ta), BenchmarkInfo(name: "Existential.Array.init.Ref3", - runFunction: run_Array_initRef3, tags: ta, setUpFunction: caRef3), + runFunction: run_Array_initRef3, tags: ta), BenchmarkInfo(name: "Existential.Array.init.Ref4", - runFunction: run_Array_initRef4, tags: ta, setUpFunction: caRef4), + runFunction: run_Array_initRef4, tags: ta), BenchmarkInfo(name: "Existential.Array.init.Val0", - runFunction: run_Array_initVal0, tags: ta, setUpFunction: caVal0), + runFunction: run_Array_initVal0, tags: ta), BenchmarkInfo(name: "Existential.Array.init.Val1", - runFunction: run_Array_initVal1, tags: ta, setUpFunction: caVal1), + runFunction: run_Array_initVal1, tags: ta), BenchmarkInfo(name: "Existential.Array.init.Val2", - runFunction: run_Array_initVal2, tags: ta, setUpFunction: caVal2), + runFunction: run_Array_initVal2, tags: ta), BenchmarkInfo(name: "Existential.Array.init.Val3", - runFunction: run_Array_initVal3, tags: ta, setUpFunction: caVal3), + runFunction: run_Array_initVal3, tags: ta), BenchmarkInfo(name: "Existential.Array.init.Val4", - runFunction: run_Array_initVal4, tags: ta, setUpFunction: caVal4), + runFunction: run_Array_initVal4, tags: ta), BenchmarkInfo(name: "Existential.Array.method.1x.Ref1", - runFunction: run_Array_method1xRef1, tags: ta, setUpFunction: caRef1), + runFunction: run_Array_method1x, tags: ta, setUpFunction: caRef1), BenchmarkInfo(name: "Existential.Array.method.1x.Ref2", - runFunction: run_Array_method1xRef2, tags: ta, setUpFunction: caRef2), + runFunction: run_Array_method1x, tags: ta, setUpFunction: caRef2), BenchmarkInfo(name: "Existential.Array.method.1x.Ref3", - runFunction: run_Array_method1xRef3, tags: ta, setUpFunction: caRef3), + runFunction: run_Array_method1x, tags: ta, setUpFunction: caRef3), BenchmarkInfo(name: "Existential.Array.method.1x.Ref4", - runFunction: run_Array_method1xRef4, tags: ta, setUpFunction: caRef4), + runFunction: run_Array_method1x, tags: ta, setUpFunction: caRef4), BenchmarkInfo(name: "Existential.Array.method.1x.Val0", - runFunction: run_Array_method1xVal0, tags: ta, setUpFunction: caVal0), + runFunction: run_Array_method1x, tags: ta, setUpFunction: caVal0), BenchmarkInfo(name: "Existential.Array.method.1x.Val1", - runFunction: run_Array_method1xVal1, tags: ta, setUpFunction: caVal1), + runFunction: run_Array_method1x, tags: ta, setUpFunction: caVal1), BenchmarkInfo(name: "Existential.Array.method.1x.Val2", - runFunction: run_Array_method1xVal2, tags: ta, setUpFunction: caVal2), + runFunction: run_Array_method1x, tags: ta, setUpFunction: caVal2), BenchmarkInfo(name: "Existential.Array.method.1x.Val3", - runFunction: run_Array_method1xVal3, tags: ta, setUpFunction: caVal3), + runFunction: run_Array_method1x, tags: ta, setUpFunction: caVal3), BenchmarkInfo(name: "Existential.Array.method.1x.Val4", - runFunction: run_Array_method1xVal4, tags: ta, setUpFunction: caVal4), + runFunction: run_Array_method1x, tags: ta, setUpFunction: caVal4), BenchmarkInfo(name: "Existential.Array.method.2x.Ref1", - runFunction: run_Array_method2xRef1, tags: ta, setUpFunction: caRef1), + runFunction: run_Array_method2x, tags: ta, setUpFunction: caRef1), BenchmarkInfo(name: "Existential.Array.method.2x.Ref2", - runFunction: run_Array_method2xRef2, tags: ta, setUpFunction: caRef2), + runFunction: run_Array_method2x, tags: ta, setUpFunction: caRef2), BenchmarkInfo(name: "Existential.Array.method.2x.Ref3", - runFunction: run_Array_method2xRef3, tags: ta, setUpFunction: caRef3), + runFunction: run_Array_method2x, tags: ta, setUpFunction: caRef3), BenchmarkInfo(name: "Existential.Array.method.2x.Ref4", - runFunction: run_Array_method2xRef4, tags: ta, setUpFunction: caRef4), + runFunction: run_Array_method2x, tags: ta, setUpFunction: caRef4), BenchmarkInfo(name: "Existential.Array.method.2x.Val0", - runFunction: run_Array_method2xVal0, tags: ta, setUpFunction: caVal0), + runFunction: run_Array_method2x, tags: ta, setUpFunction: caVal0), BenchmarkInfo(name: "Existential.Array.method.2x.Val1", - runFunction: run_Array_method2xVal1, tags: ta, setUpFunction: caVal1), + runFunction: run_Array_method2x, tags: ta, setUpFunction: caVal1), BenchmarkInfo(name: "Existential.Array.method.2x.Val2", - runFunction: run_Array_method2xVal2, tags: ta, setUpFunction: caVal2), + runFunction: run_Array_method2x, tags: ta, setUpFunction: caVal2), BenchmarkInfo(name: "Existential.Array.method.2x.Val3", - runFunction: run_Array_method2xVal3, tags: ta, setUpFunction: caVal3), + runFunction: run_Array_method2x, tags: ta, setUpFunction: caVal3), BenchmarkInfo(name: "Existential.Array.method.2x.Val4", - runFunction: run_Array_method2xVal4, tags: ta, setUpFunction: caVal4), + runFunction: run_Array_method2x, tags: ta, setUpFunction: caVal4), BenchmarkInfo(name: "Existential.Array.Mutating.Ref1", - runFunction: run_ArrayMutatingRef1, tags: ta, setUpFunction: caRef1), + runFunction: run_ArrayMutating, tags: ta, setUpFunction: caRef1), BenchmarkInfo(name: "Existential.Array.Mutating.Ref2", - runFunction: run_ArrayMutatingRef2, tags: ta, setUpFunction: caRef2), + runFunction: run_ArrayMutating, tags: ta, setUpFunction: caRef2), BenchmarkInfo(name: "Existential.Array.Mutating.Ref3", - runFunction: run_ArrayMutatingRef3, tags: ta, setUpFunction: caRef3), + runFunction: run_ArrayMutating, tags: ta, setUpFunction: caRef3), BenchmarkInfo(name: "Existential.Array.Mutating.Ref4", - runFunction: run_ArrayMutatingRef4, tags: ta, setUpFunction: caRef4), + runFunction: run_ArrayMutating, tags: ta, setUpFunction: caRef4), BenchmarkInfo(name: "Existential.Array.Mutating.Val0", - runFunction: run_ArrayMutatingVal0, tags: ta, setUpFunction: caVal0), + runFunction: run_ArrayMutating, tags: ta, setUpFunction: caVal0), BenchmarkInfo(name: "Existential.Array.Mutating.Val1", - runFunction: run_ArrayMutatingVal1, tags: ta, setUpFunction: caVal1), + runFunction: run_ArrayMutating, tags: ta, setUpFunction: caVal1), BenchmarkInfo(name: "Existential.Array.Mutating.Val2", - runFunction: run_ArrayMutatingVal2, tags: ta, setUpFunction: caVal2), + runFunction: run_ArrayMutating, tags: ta, setUpFunction: caVal2), BenchmarkInfo(name: "Existential.Array.Mutating.Val3", - runFunction: run_ArrayMutatingVal3, tags: ta, setUpFunction: caVal3), + runFunction: run_ArrayMutating, tags: ta, setUpFunction: caVal3), BenchmarkInfo(name: "Existential.Array.Mutating.Val4", - runFunction: run_ArrayMutatingVal4, tags: ta, setUpFunction: caVal4), + runFunction: run_ArrayMutating, tags: ta, setUpFunction: caVal4), BenchmarkInfo(name: "Existential.Array.Shift.Ref1", - runFunction: run_ArrayShiftRef1, tags: ta, setUpFunction: caRef1), + runFunction: run_ArrayShift, tags: ta, setUpFunction: caRef1), BenchmarkInfo(name: "Existential.Array.Shift.Ref2", - runFunction: run_ArrayShiftRef2, tags: ta, setUpFunction: caRef2), + runFunction: run_ArrayShift, tags: ta, setUpFunction: caRef2), BenchmarkInfo(name: "Existential.Array.Shift.Ref3", - runFunction: run_ArrayShiftRef3, tags: ta, setUpFunction: caRef3), + runFunction: run_ArrayShift, tags: ta, setUpFunction: caRef3), BenchmarkInfo(name: "Existential.Array.Shift.Ref4", - runFunction: run_ArrayShiftRef4, tags: ta, setUpFunction: caRef4), + runFunction: run_ArrayShift, tags: ta, setUpFunction: caRef4), BenchmarkInfo(name: "Existential.Array.Shift.Val0", - runFunction: run_ArrayShiftVal0, tags: ta, setUpFunction: caVal0), + runFunction: run_ArrayShift, tags: ta, setUpFunction: caVal0), BenchmarkInfo(name: "Existential.Array.Shift.Val1", - runFunction: run_ArrayShiftVal1, tags: ta, setUpFunction: caVal1), + runFunction: run_ArrayShift, tags: ta, setUpFunction: caVal1), BenchmarkInfo(name: "Existential.Array.Shift.Val2", - runFunction: run_ArrayShiftVal2, tags: ta, setUpFunction: caVal2), + runFunction: run_ArrayShift, tags: ta, setUpFunction: caVal2), BenchmarkInfo(name: "Existential.Array.Shift.Val3", - runFunction: run_ArrayShiftVal3, tags: ta, setUpFunction: caVal3), + runFunction: run_ArrayShift, tags: ta, setUpFunction: caVal3), BenchmarkInfo(name: "Existential.Array.Shift.Val4", - runFunction: run_ArrayShiftVal4, tags: ta, setUpFunction: caVal4), + runFunction: run_ArrayShift, tags: ta, setUpFunction: caVal4), BenchmarkInfo(name: "Existential.Array.ConditionalShift.Ref1", - runFunction: run_ArrayConditionalShiftRef1, tags: ta, setUpFunction: caRef1), + runFunction: run_ArrayConditionalShift, tags: ta, setUpFunction: caRef1), BenchmarkInfo(name: "Existential.Array.ConditionalShift.Ref2", - runFunction: run_ArrayConditionalShiftRef2, tags: ta, setUpFunction: caRef2), + runFunction: run_ArrayConditionalShift, tags: ta, setUpFunction: caRef2), BenchmarkInfo(name: "Existential.Array.ConditionalShift.Ref3", - runFunction: run_ArrayConditionalShiftRef3, tags: ta, setUpFunction: caRef3), + runFunction: run_ArrayConditionalShift, tags: ta, setUpFunction: caRef3), BenchmarkInfo(name: "Existential.Array.ConditionalShift.Ref4", - runFunction: run_ArrayConditionalShiftRef4, tags: ta, setUpFunction: caRef4), + runFunction: run_ArrayConditionalShift, tags: ta, setUpFunction: caRef4), BenchmarkInfo(name: "Existential.Array.ConditionalShift.Val0", - runFunction: run_ArrayConditionalShiftVal0, tags: ta, setUpFunction: caVal0), + runFunction: run_ArrayConditionalShift, tags: ta, setUpFunction: caVal0), BenchmarkInfo(name: "Existential.Array.ConditionalShift.Val1", - runFunction: run_ArrayConditionalShiftVal1, tags: ta, setUpFunction: caVal1), + runFunction: run_ArrayConditionalShift, tags: ta, setUpFunction: caVal1), BenchmarkInfo(name: "Existential.Array.ConditionalShift.Val2", - runFunction: run_ArrayConditionalShiftVal2, tags: ta, setUpFunction: caVal2), + runFunction: run_ArrayConditionalShift, tags: ta, setUpFunction: caVal2), BenchmarkInfo(name: "Existential.Array.ConditionalShift.Val3", - runFunction: run_ArrayConditionalShiftVal3, tags: ta, setUpFunction: caVal3), + runFunction: run_ArrayConditionalShift, tags: ta, setUpFunction: caVal3), BenchmarkInfo(name: "Existential.Array.ConditionalShift.Val4", - runFunction: run_ArrayConditionalShiftVal4, tags: ta, setUpFunction: caVal4), + runFunction: run_ArrayConditionalShift, tags: ta, setUpFunction: caVal4), ] // To exclude the setup overhead of existential array initialization, @@ -529,7 +529,7 @@ func run_Array_init(withType: T.Type, numberOfTimes N: Int) { } } -func run_Array_method1x(withType: T.Type, numberOfTimes N: Int) { +func run_Array_method1x(_ N: Int) { let existentialArray = grabArray() for _ in 0 ..< N * 100 { for elt in existentialArray { @@ -540,7 +540,7 @@ func run_Array_method1x(withType: T.Type, numberOfTimes N: Int) } } -func run_Array_method2x(withType: T.Type, numberOfTimes N: Int) { +func run_Array_method2x(_ N: Int) { let existentialArray = grabArray() for _ in 0 ..< N * 100 { for elt in existentialArray { @@ -551,7 +551,7 @@ func run_Array_method2x(withType: T.Type, numberOfTimes N: Int) } } -func run_ArrayMutating(withType: T.Type, numberOfTimes N: Int) { +func run_ArrayMutating(_ N: Int) { var existentialArray = grabArray() for _ in 0 ..< N * 100 { for i in 0 ..< existentialArray.count { @@ -562,7 +562,7 @@ func run_ArrayMutating(withType: T.Type, numberOfTimes N: Int) { } } -func run_ArrayShift(withType: T.Type, numberOfTimes N: Int) { +func run_ArrayShift(_ N: Int) { var existentialArray = grabArray() for _ in 0 ..< N * 10 { for i in 0 ..< existentialArray.count-1 { @@ -571,7 +571,7 @@ func run_ArrayShift(withType: T.Type, numberOfTimes N: Int) { } } -func run_ArrayConditionalShift(withType: T.Type, numberOfTimes N: Int) { +func run_ArrayConditionalShift(_ N: Int) { var existentialArray = grabArray() for _ in 0 ..< N * 10 { for i in 0 ..< existentialArray.count-1 { @@ -584,7 +584,7 @@ func run_ArrayConditionalShift(withType: T.Type, numberOfTimes N } } -// method.1x. +// method.1x public func run_method1xVal0(_ N: Int) { run_method1x(withType: Val0.self, numberOfTimes: N) } @@ -613,7 +613,7 @@ public func run_method1xRef4(_ N: Int) { run_method1x(withType: Ref4.self, numberOfTimes: N) } -// method.2x. +// method.2x public func run_method2xVal0(_ N: Int) { run_method2x(withType: Val0.self, numberOfTimes: N) } @@ -642,7 +642,7 @@ public func run_method2xRef4(_ N: Int) { run_method2x(withType: Ref4.self, numberOfTimes: N) } -// Pass.method.1x. +// Pass.method.1x public func run_Pass_method1xVal0(_ N: Int) { run_Pass_method1x(withType: Val0.self, numberOfTimes: N) } @@ -671,7 +671,7 @@ public func run_Pass_method1xRef4(_ N: Int) { run_Pass_method1x(withType: Ref4.self, numberOfTimes: N) } -// Pass.method.2x. +// Pass.method.2x public func run_Pass_method2xVal0(_ N: Int) { run_Pass_method2x(withType: Val0.self, numberOfTimes: N) } @@ -700,7 +700,7 @@ public func run_Pass_method2xRef4(_ N: Int) { run_Pass_method2x(withType: Ref4.self, numberOfTimes: N) } -// Mutating. +// Mutating public func run_MutatingVal0(_ N: Int) { run_Mutating(withType: Val0.self, numberOfTimes: N) } @@ -729,7 +729,7 @@ public func run_MutatingRef4(_ N: Int) { run_Mutating(withType: Ref4.self, numberOfTimes: N) } -// MutatingAndNonMutating. +// MutatingAndNonMutating public func run_MutatingAndNonMutatingVal0(_ N: Int) { run_MutatingAndNonMutating(withType: Val0.self, numberOfTimes: N) } @@ -758,7 +758,7 @@ public func run_MutatingAndNonMutatingRef4(_ N: Int) { run_MutatingAndNonMutating(withType: Ref4.self, numberOfTimes: N) } -// Array.init. +// Array.init public func run_Array_initVal0(_ N: Int) { run_Array_init(withType: Val0.self, numberOfTimes: N) } @@ -787,151 +787,6 @@ public func run_Array_initRef4(_ N: Int) { run_Array_init(withType: Ref4.self, numberOfTimes: N) } -// Array.method.1x. -public func run_Array_method1xVal0(_ N: Int) { - run_Array_method1x(withType: Val0.self, numberOfTimes: N) -} -public func run_Array_method1xVal1(_ N: Int) { - run_Array_method1x(withType: Val1.self, numberOfTimes: N) -} -public func run_Array_method1xVal2(_ N: Int) { - run_Array_method1x(withType: Val2.self, numberOfTimes: N) -} -public func run_Array_method1xVal3(_ N: Int) { - run_Array_method1x(withType: Val3.self, numberOfTimes: N) -} -public func run_Array_method1xVal4(_ N: Int) { - run_Array_method1x(withType: Val4.self, numberOfTimes: N) -} -public func run_Array_method1xRef1(_ N: Int) { - run_Array_method1x(withType: Ref1.self, numberOfTimes: N) -} -public func run_Array_method1xRef2(_ N: Int) { - run_Array_method1x(withType: Ref2.self, numberOfTimes: N) -} -public func run_Array_method1xRef3(_ N: Int) { - run_Array_method1x(withType: Ref3.self, numberOfTimes: N) -} -public func run_Array_method1xRef4(_ N: Int) { - run_Array_method1x(withType: Ref4.self, numberOfTimes: N) -} - -// Array.method.2x. -public func run_Array_method2xVal0(_ N: Int) { - run_Array_method2x(withType: Val0.self, numberOfTimes: N) -} -public func run_Array_method2xVal1(_ N: Int) { - run_Array_method2x(withType: Val1.self, numberOfTimes: N) -} -public func run_Array_method2xVal2(_ N: Int) { - run_Array_method2x(withType: Val2.self, numberOfTimes: N) -} -public func run_Array_method2xVal3(_ N: Int) { - run_Array_method2x(withType: Val3.self, numberOfTimes: N) -} -public func run_Array_method2xVal4(_ N: Int) { - run_Array_method2x(withType: Val4.self, numberOfTimes: N) -} -public func run_Array_method2xRef1(_ N: Int) { - run_Array_method2x(withType: Ref1.self, numberOfTimes: N) -} -public func run_Array_method2xRef2(_ N: Int) { - run_Array_method2x(withType: Ref2.self, numberOfTimes: N) -} -public func run_Array_method2xRef3(_ N: Int) { - run_Array_method2x(withType: Ref3.self, numberOfTimes: N) -} -public func run_Array_method2xRef4(_ N: Int) { - run_Array_method2x(withType: Ref4.self, numberOfTimes: N) -} - -// Array.Mutating. -public func run_ArrayMutatingVal0(_ N: Int) { - run_ArrayMutating(withType: Val0.self, numberOfTimes: N) -} -public func run_ArrayMutatingVal1(_ N: Int) { - run_ArrayMutating(withType: Val1.self, numberOfTimes: N) -} -public func run_ArrayMutatingVal2(_ N: Int) { - run_ArrayMutating(withType: Val2.self, numberOfTimes: N) -} -public func run_ArrayMutatingVal3(_ N: Int) { - run_ArrayMutating(withType: Val3.self, numberOfTimes: N) -} -public func run_ArrayMutatingVal4(_ N: Int) { - run_ArrayMutating(withType: Val4.self, numberOfTimes: N) -} -public func run_ArrayMutatingRef1(_ N: Int) { - run_ArrayMutating(withType: Ref1.self, numberOfTimes: N) -} -public func run_ArrayMutatingRef2(_ N: Int) { - run_ArrayMutating(withType: Ref2.self, numberOfTimes: N) -} -public func run_ArrayMutatingRef3(_ N: Int) { - run_ArrayMutating(withType: Ref3.self, numberOfTimes: N) -} -public func run_ArrayMutatingRef4(_ N: Int) { - run_ArrayMutating(withType: Ref4.self, numberOfTimes: N) -} - -// Array.Shift. -public func run_ArrayShiftVal0(_ N: Int) { - run_ArrayShift(withType: Val0.self, numberOfTimes: N) -} -public func run_ArrayShiftVal1(_ N: Int) { - run_ArrayShift(withType: Val1.self, numberOfTimes: N) -} -public func run_ArrayShiftVal2(_ N: Int) { - run_ArrayShift(withType: Val2.self, numberOfTimes: N) -} -public func run_ArrayShiftVal3(_ N: Int) { - run_ArrayShift(withType: Val3.self, numberOfTimes: N) -} -public func run_ArrayShiftVal4(_ N: Int) { - run_ArrayShift(withType: Val4.self, numberOfTimes: N) -} -public func run_ArrayShiftRef1(_ N: Int) { - run_ArrayShift(withType: Ref1.self, numberOfTimes: N) -} -public func run_ArrayShiftRef2(_ N: Int) { - run_ArrayShift(withType: Ref2.self, numberOfTimes: N) -} -public func run_ArrayShiftRef3(_ N: Int) { - run_ArrayShift(withType: Ref3.self, numberOfTimes: N) -} -public func run_ArrayShiftRef4(_ N: Int) { - run_ArrayShift(withType: Ref4.self, numberOfTimes: N) -} - -// Array.ConditionalShift. -public func run_ArrayConditionalShiftVal0(_ N: Int) { - run_ArrayConditionalShift(withType: Val0.self, numberOfTimes: N) -} -public func run_ArrayConditionalShiftVal1(_ N: Int) { - run_ArrayConditionalShift(withType: Val1.self, numberOfTimes: N) -} -public func run_ArrayConditionalShiftVal2(_ N: Int) { - run_ArrayConditionalShift(withType: Val2.self, numberOfTimes: N) -} -public func run_ArrayConditionalShiftVal3(_ N: Int) { - run_ArrayConditionalShift(withType: Val3.self, numberOfTimes: N) -} -public func run_ArrayConditionalShiftVal4(_ N: Int) { - run_ArrayConditionalShift(withType: Val4.self, numberOfTimes: N) -} -public func run_ArrayConditionalShiftRef1(_ N: Int) { - run_ArrayConditionalShift(withType: Ref1.self, numberOfTimes: N) -} -public func run_ArrayConditionalShiftRef2(_ N: Int) { - run_ArrayConditionalShift(withType: Ref2.self, numberOfTimes: N) -} -public func run_ArrayConditionalShiftRef3(_ N: Int) { - run_ArrayConditionalShift(withType: Ref3.self, numberOfTimes: N) -} -public func run_ArrayConditionalShiftRef4(_ N: Int) { - run_ArrayConditionalShift(withType: Ref4.self, numberOfTimes: N) -} - // Local Variables: // eval: (read-only-mode 1) // End: diff --git a/benchmark/single-source/ExistentialPerformance.swift.gyb b/benchmark/single-source/ExistentialPerformance.swift.gyb index cb36f16edf1c5..ac4604e258eb3 100644 --- a/benchmark/single-source/ExistentialPerformance.swift.gyb +++ b/benchmark/single-source/ExistentialPerformance.swift.gyb @@ -106,9 +106,12 @@ Workloads = [ Vars = [(0, 0), (1, 3), (2, 7), (3, 13)] Refs = ['Ref' + str(i) for i in range(1, 5)] Vals = ['Val' + str(i) for i in range(0, 5)] -Names = [group + '.' + variant +Names = [(group + '.' + variant, group, variant) for (group, _, _, _) in Workloads for variant in Refs + Vals] +def typed_variants(name): + return 'Array' not in name or 'Array.init' in name + import re method_variant_re = re.compile(r'\.([a-z])') @@ -122,12 +125,13 @@ def run_function_name(benchmark_name): '', benchmark_name))) }% public let ExistentialPerformance: [BenchmarkInfo] = [ -% for Name in Names: +% for (Name, Group, Variant) in Names: BenchmarkInfo(name: "Existential.${Name}", runFunction: ${ - run_function_name(Name)}, tags: ${ + run_function_name(Name) if typed_variants(Group) else + run_function_name(Group)}, tags: ${ 'ta' if 'Array' in Name else 't'}${ - (', setUpFunction: ca' + Name.split('.')[-1]) if 'Array' in Name else '' }), + (', setUpFunction: ca' + Variant) if not typed_variants(Group) else '' }), % end ] @@ -242,22 +246,30 @@ func passExistentialTwiceTwoMethodCalls(_ e0: Existential, _ e1: Existential) -> Bool { return e0.doIt() && e1.doIt() && e0.reallyDoIt() && e1.reallyDoIt() } -% for (name, setup, multiple, workload) in Workloads: +%{ +def type(name): + return ( + '(withType: T.Type, numberOfTimes' if typed_variants(name) + else '(_') +}% +% for (group, setup, multiple, workload) in Workloads: ${""" -func {0}(withType: T.Type, numberOfTimes N: Int) {{ +func {0}{4} N: Int) {{ {1} for _ in 0 ..< N * {2} {{{3} }} -}}""".format(run_function_name(name), setup, multiple, workload)} +}}""".format(run_function_name(group), setup, multiple, workload, type(group))} % end -% for (Name, _, _, _) in Workloads: -// ${Name}. -% for Variant in Vals + Refs: -public func ${run_function_name(Name + '.' + Variant)}(_ N: Int) { - ${run_function_name(Name)}(withType: ${Variant}.self, numberOfTimes: N) +% for (Group, _, _, _) in Workloads: +% if typed_variants(Group): +// ${Group} +% for Variant in Vals + Refs: +public func ${run_function_name(Group + '.' + Variant)}(_ N: Int) { + ${run_function_name(Group)}(withType: ${Variant}.self, numberOfTimes: N) } -% end +% end +% end % end // ${'Local Variables'}: // eval: (read-only-mode 1) From 35163f19c7f8be0f313ba6cf3bc703b1da662f90 Mon Sep 17 00:00:00 2001 From: Pavol Vaskovic Date: Sat, 17 Nov 2018 08:40:57 +0100 Subject: [PATCH 09/12] [benchmark] Refactor: Despecialized Existential The technique from preceding commit, can be used to fully determine the tested type variant in the `setUpFunction` and use a non-generic `runFunction`s for all the benchmarks. This eliminates 202 lines of boilerplate. --- .../ExistentialPerformance.swift | 386 +++++------------- .../ExistentialPerformance.swift.gyb | 60 +-- 2 files changed, 110 insertions(+), 336 deletions(-) diff --git a/benchmark/single-source/ExistentialPerformance.swift b/benchmark/single-source/ExistentialPerformance.swift index 7d42a5b9b5b6f..7cfec9f0c311b 100644 --- a/benchmark/single-source/ExistentialPerformance.swift +++ b/benchmark/single-source/ExistentialPerformance.swift @@ -23,131 +23,131 @@ let ta: [BenchmarkCategory] = [.api, .Array] public let ExistentialPerformance: [BenchmarkInfo] = [ BenchmarkInfo(name: "Existential.method.1x.Ref1", - runFunction: run_method1xRef1, tags: t), + runFunction: run_method1x, tags: t, setUpFunction: etRef1), BenchmarkInfo(name: "Existential.method.1x.Ref2", - runFunction: run_method1xRef2, tags: t), + runFunction: run_method1x, tags: t, setUpFunction: etRef2), BenchmarkInfo(name: "Existential.method.1x.Ref3", - runFunction: run_method1xRef3, tags: t), + runFunction: run_method1x, tags: t, setUpFunction: etRef3), BenchmarkInfo(name: "Existential.method.1x.Ref4", - runFunction: run_method1xRef4, tags: t), + runFunction: run_method1x, tags: t, setUpFunction: etRef4), BenchmarkInfo(name: "Existential.method.1x.Val0", - runFunction: run_method1xVal0, tags: t), + runFunction: run_method1x, tags: t, setUpFunction: etVal0), BenchmarkInfo(name: "Existential.method.1x.Val1", - runFunction: run_method1xVal1, tags: t), + runFunction: run_method1x, tags: t, setUpFunction: etVal1), BenchmarkInfo(name: "Existential.method.1x.Val2", - runFunction: run_method1xVal2, tags: t), + runFunction: run_method1x, tags: t, setUpFunction: etVal2), BenchmarkInfo(name: "Existential.method.1x.Val3", - runFunction: run_method1xVal3, tags: t), + runFunction: run_method1x, tags: t, setUpFunction: etVal3), BenchmarkInfo(name: "Existential.method.1x.Val4", - runFunction: run_method1xVal4, tags: t), + runFunction: run_method1x, tags: t, setUpFunction: etVal4), BenchmarkInfo(name: "Existential.method.2x.Ref1", - runFunction: run_method2xRef1, tags: t), + runFunction: run_method2x, tags: t, setUpFunction: etRef1), BenchmarkInfo(name: "Existential.method.2x.Ref2", - runFunction: run_method2xRef2, tags: t), + runFunction: run_method2x, tags: t, setUpFunction: etRef2), BenchmarkInfo(name: "Existential.method.2x.Ref3", - runFunction: run_method2xRef3, tags: t), + runFunction: run_method2x, tags: t, setUpFunction: etRef3), BenchmarkInfo(name: "Existential.method.2x.Ref4", - runFunction: run_method2xRef4, tags: t), + runFunction: run_method2x, tags: t, setUpFunction: etRef4), BenchmarkInfo(name: "Existential.method.2x.Val0", - runFunction: run_method2xVal0, tags: t), + runFunction: run_method2x, tags: t, setUpFunction: etVal0), BenchmarkInfo(name: "Existential.method.2x.Val1", - runFunction: run_method2xVal1, tags: t), + runFunction: run_method2x, tags: t, setUpFunction: etVal1), BenchmarkInfo(name: "Existential.method.2x.Val2", - runFunction: run_method2xVal2, tags: t), + runFunction: run_method2x, tags: t, setUpFunction: etVal2), BenchmarkInfo(name: "Existential.method.2x.Val3", - runFunction: run_method2xVal3, tags: t), + runFunction: run_method2x, tags: t, setUpFunction: etVal3), BenchmarkInfo(name: "Existential.method.2x.Val4", - runFunction: run_method2xVal4, tags: t), + runFunction: run_method2x, tags: t, setUpFunction: etVal4), BenchmarkInfo(name: "Existential.Pass.method.1x.Ref1", - runFunction: run_Pass_method1xRef1, tags: t), + runFunction: run_Pass_method1x, tags: t, setUpFunction: etRef1), BenchmarkInfo(name: "Existential.Pass.method.1x.Ref2", - runFunction: run_Pass_method1xRef2, tags: t), + runFunction: run_Pass_method1x, tags: t, setUpFunction: etRef2), BenchmarkInfo(name: "Existential.Pass.method.1x.Ref3", - runFunction: run_Pass_method1xRef3, tags: t), + runFunction: run_Pass_method1x, tags: t, setUpFunction: etRef3), BenchmarkInfo(name: "Existential.Pass.method.1x.Ref4", - runFunction: run_Pass_method1xRef4, tags: t), + runFunction: run_Pass_method1x, tags: t, setUpFunction: etRef4), BenchmarkInfo(name: "Existential.Pass.method.1x.Val0", - runFunction: run_Pass_method1xVal0, tags: t), + runFunction: run_Pass_method1x, tags: t, setUpFunction: etVal0), BenchmarkInfo(name: "Existential.Pass.method.1x.Val1", - runFunction: run_Pass_method1xVal1, tags: t), + runFunction: run_Pass_method1x, tags: t, setUpFunction: etVal1), BenchmarkInfo(name: "Existential.Pass.method.1x.Val2", - runFunction: run_Pass_method1xVal2, tags: t), + runFunction: run_Pass_method1x, tags: t, setUpFunction: etVal2), BenchmarkInfo(name: "Existential.Pass.method.1x.Val3", - runFunction: run_Pass_method1xVal3, tags: t), + runFunction: run_Pass_method1x, tags: t, setUpFunction: etVal3), BenchmarkInfo(name: "Existential.Pass.method.1x.Val4", - runFunction: run_Pass_method1xVal4, tags: t), + runFunction: run_Pass_method1x, tags: t, setUpFunction: etVal4), BenchmarkInfo(name: "Existential.Pass.method.2x.Ref1", - runFunction: run_Pass_method2xRef1, tags: t), + runFunction: run_Pass_method2x, tags: t, setUpFunction: etRef1), BenchmarkInfo(name: "Existential.Pass.method.2x.Ref2", - runFunction: run_Pass_method2xRef2, tags: t), + runFunction: run_Pass_method2x, tags: t, setUpFunction: etRef2), BenchmarkInfo(name: "Existential.Pass.method.2x.Ref3", - runFunction: run_Pass_method2xRef3, tags: t), + runFunction: run_Pass_method2x, tags: t, setUpFunction: etRef3), BenchmarkInfo(name: "Existential.Pass.method.2x.Ref4", - runFunction: run_Pass_method2xRef4, tags: t), + runFunction: run_Pass_method2x, tags: t, setUpFunction: etRef4), BenchmarkInfo(name: "Existential.Pass.method.2x.Val0", - runFunction: run_Pass_method2xVal0, tags: t), + runFunction: run_Pass_method2x, tags: t, setUpFunction: etVal0), BenchmarkInfo(name: "Existential.Pass.method.2x.Val1", - runFunction: run_Pass_method2xVal1, tags: t), + runFunction: run_Pass_method2x, tags: t, setUpFunction: etVal1), BenchmarkInfo(name: "Existential.Pass.method.2x.Val2", - runFunction: run_Pass_method2xVal2, tags: t), + runFunction: run_Pass_method2x, tags: t, setUpFunction: etVal2), BenchmarkInfo(name: "Existential.Pass.method.2x.Val3", - runFunction: run_Pass_method2xVal3, tags: t), + runFunction: run_Pass_method2x, tags: t, setUpFunction: etVal3), BenchmarkInfo(name: "Existential.Pass.method.2x.Val4", - runFunction: run_Pass_method2xVal4, tags: t), + runFunction: run_Pass_method2x, tags: t, setUpFunction: etVal4), BenchmarkInfo(name: "Existential.Mutating.Ref1", - runFunction: run_MutatingRef1, tags: t), + runFunction: run_Mutating, tags: t, setUpFunction: etRef1), BenchmarkInfo(name: "Existential.Mutating.Ref2", - runFunction: run_MutatingRef2, tags: t), + runFunction: run_Mutating, tags: t, setUpFunction: etRef2), BenchmarkInfo(name: "Existential.Mutating.Ref3", - runFunction: run_MutatingRef3, tags: t), + runFunction: run_Mutating, tags: t, setUpFunction: etRef3), BenchmarkInfo(name: "Existential.Mutating.Ref4", - runFunction: run_MutatingRef4, tags: t), + runFunction: run_Mutating, tags: t, setUpFunction: etRef4), BenchmarkInfo(name: "Existential.Mutating.Val0", - runFunction: run_MutatingVal0, tags: t), + runFunction: run_Mutating, tags: t, setUpFunction: etVal0), BenchmarkInfo(name: "Existential.Mutating.Val1", - runFunction: run_MutatingVal1, tags: t), + runFunction: run_Mutating, tags: t, setUpFunction: etVal1), BenchmarkInfo(name: "Existential.Mutating.Val2", - runFunction: run_MutatingVal2, tags: t), + runFunction: run_Mutating, tags: t, setUpFunction: etVal2), BenchmarkInfo(name: "Existential.Mutating.Val3", - runFunction: run_MutatingVal3, tags: t), + runFunction: run_Mutating, tags: t, setUpFunction: etVal3), BenchmarkInfo(name: "Existential.Mutating.Val4", - runFunction: run_MutatingVal4, tags: t), + runFunction: run_Mutating, tags: t, setUpFunction: etVal4), BenchmarkInfo(name: "Existential.MutatingAndNonMutating.Ref1", - runFunction: run_MutatingAndNonMutatingRef1, tags: t), + runFunction: run_MutatingAndNonMutating, tags: t, setUpFunction: etRef1), BenchmarkInfo(name: "Existential.MutatingAndNonMutating.Ref2", - runFunction: run_MutatingAndNonMutatingRef2, tags: t), + runFunction: run_MutatingAndNonMutating, tags: t, setUpFunction: etRef2), BenchmarkInfo(name: "Existential.MutatingAndNonMutating.Ref3", - runFunction: run_MutatingAndNonMutatingRef3, tags: t), + runFunction: run_MutatingAndNonMutating, tags: t, setUpFunction: etRef3), BenchmarkInfo(name: "Existential.MutatingAndNonMutating.Ref4", - runFunction: run_MutatingAndNonMutatingRef4, tags: t), + runFunction: run_MutatingAndNonMutating, tags: t, setUpFunction: etRef4), BenchmarkInfo(name: "Existential.MutatingAndNonMutating.Val0", - runFunction: run_MutatingAndNonMutatingVal0, tags: t), + runFunction: run_MutatingAndNonMutating, tags: t, setUpFunction: etVal0), BenchmarkInfo(name: "Existential.MutatingAndNonMutating.Val1", - runFunction: run_MutatingAndNonMutatingVal1, tags: t), + runFunction: run_MutatingAndNonMutating, tags: t, setUpFunction: etVal1), BenchmarkInfo(name: "Existential.MutatingAndNonMutating.Val2", - runFunction: run_MutatingAndNonMutatingVal2, tags: t), + runFunction: run_MutatingAndNonMutating, tags: t, setUpFunction: etVal2), BenchmarkInfo(name: "Existential.MutatingAndNonMutating.Val3", - runFunction: run_MutatingAndNonMutatingVal3, tags: t), + runFunction: run_MutatingAndNonMutating, tags: t, setUpFunction: etVal3), BenchmarkInfo(name: "Existential.MutatingAndNonMutating.Val4", - runFunction: run_MutatingAndNonMutatingVal4, tags: t), + runFunction: run_MutatingAndNonMutating, tags: t, setUpFunction: etVal4), BenchmarkInfo(name: "Existential.Array.init.Ref1", - runFunction: run_Array_initRef1, tags: ta), + runFunction: run_Array_init, tags: ta, setUpFunction: etRef1), BenchmarkInfo(name: "Existential.Array.init.Ref2", - runFunction: run_Array_initRef2, tags: ta), + runFunction: run_Array_init, tags: ta, setUpFunction: etRef2), BenchmarkInfo(name: "Existential.Array.init.Ref3", - runFunction: run_Array_initRef3, tags: ta), + runFunction: run_Array_init, tags: ta, setUpFunction: etRef3), BenchmarkInfo(name: "Existential.Array.init.Ref4", - runFunction: run_Array_initRef4, tags: ta), + runFunction: run_Array_init, tags: ta, setUpFunction: etRef4), BenchmarkInfo(name: "Existential.Array.init.Val0", - runFunction: run_Array_initVal0, tags: ta), + runFunction: run_Array_init, tags: ta, setUpFunction: etVal0), BenchmarkInfo(name: "Existential.Array.init.Val1", - runFunction: run_Array_initVal1, tags: ta), + runFunction: run_Array_init, tags: ta, setUpFunction: etVal1), BenchmarkInfo(name: "Existential.Array.init.Val2", - runFunction: run_Array_initVal2, tags: ta), + runFunction: run_Array_init, tags: ta, setUpFunction: etVal2), BenchmarkInfo(name: "Existential.Array.init.Val3", - runFunction: run_Array_initVal3, tags: ta), + runFunction: run_Array_init, tags: ta, setUpFunction: etVal3), BenchmarkInfo(name: "Existential.Array.init.Val4", - runFunction: run_Array_initVal4, tags: ta), + runFunction: run_Array_init, tags: ta, setUpFunction: etVal4), BenchmarkInfo(name: "Existential.Array.method.1x.Ref1", runFunction: run_Array_method1x, tags: ta, setUpFunction: caRef1), BenchmarkInfo(name: "Existential.Array.method.1x.Ref2", @@ -244,7 +244,7 @@ public let ExistentialPerformance: [BenchmarkInfo] = [ // these are setup functions that **create array** for each variant type. var array: [Existential]! func ca(_: T.Type) { - array = initExistentialArray(withType: T.self, count: 128) + array = Array(repeating: T(), count: 128) } func caVal0() { ca(Val0.self) } func caVal1() { ca(Val1.self) } @@ -267,6 +267,18 @@ func grabArray() -> [Existential] { // transfer array ownership to caller return array! } +// `setUpFunctions` that determine which existential type will be tested +var existentialType: Existential.Type! +func etVal0() { existentialType = Val0.self } +func etVal1() { existentialType = Val1.self } +func etVal2() { existentialType = Val2.self } +func etVal3() { existentialType = Val3.self } +func etVal4() { existentialType = Val4.self } +func etRef1() { existentialType = Ref1.self } +func etRef2() { existentialType = Ref2.self } +func etRef3() { existentialType = Ref3.self } +func etRef4() { existentialType = Ref4.self } + protocol Existential { init() func doIt() -> Bool @@ -442,17 +454,6 @@ struct Ref4 : Existential { } -@inline(never) -func initExistential(withType: T.Type) -> Existential { - return T() -} - -@inline(never) -func initExistentialArray(withType: T.Type, count c: Int) - -> [Existential] { - return [T](repeating: T(), count: c) -} - @inline(never) func passExistentialTwiceOneMethodCall(_ e0: Existential, _ e1: Existential) -> Bool { @@ -465,8 +466,8 @@ func passExistentialTwiceTwoMethodCalls(_ e0: Existential, _ e1: Existential) return e0.doIt() && e1.doIt() && e0.reallyDoIt() && e1.reallyDoIt() } -func run_method1x(withType: T.Type, numberOfTimes N: Int) { - let existential = initExistential(withType: T.self) +func run_method1x(_ N: Int) { + let existential = existentialType.init() for _ in 0 ..< N * 20_000 { if !existential.doIt() { fatalError("expected true") @@ -474,8 +475,8 @@ func run_method1x(withType: T.Type, numberOfTimes N: Int) { } } -func run_method2x(withType: T.Type, numberOfTimes N: Int) { - let existential = initExistential(withType: T.self) +func run_method2x(_ N: Int) { + let existential = existentialType.init() for _ in 0 ..< N * 20_000 { if !existential.doIt() || !existential.reallyDoIt() { fatalError("expected true") @@ -483,9 +484,9 @@ func run_method2x(withType: T.Type, numberOfTimes N: Int) { } } -func run_Pass_method1x(withType: T.Type, numberOfTimes N: Int) { - let existential = initExistential(withType: T.self) - let existential2 = initExistential(withType: T.self) +func run_Pass_method1x(_ N: Int) { + let existential = existentialType.init() + let existential2 = existentialType.init() for _ in 0 ..< N * 20_000 { if !passExistentialTwiceOneMethodCall(existential, existential2) { fatalError("expected true") @@ -493,9 +494,9 @@ func run_Pass_method1x(withType: T.Type, numberOfTimes N: Int) { } } -func run_Pass_method2x(withType: T.Type, numberOfTimes N: Int) { - let existential = initExistential(withType: T.self) - let existential2 = initExistential(withType: T.self) +func run_Pass_method2x(_ N: Int) { + let existential = existentialType.init() + let existential2 = existentialType.init() for _ in 0 ..< N * 20_000 { if !passExistentialTwiceTwoMethodCalls(existential, existential2) { fatalError("expected true") @@ -503,8 +504,8 @@ func run_Pass_method2x(withType: T.Type, numberOfTimes N: Int) { } } -func run_Mutating(withType: T.Type, numberOfTimes N: Int) { - var existential = initExistential(withType: T.self) +func run_Mutating(_ N: Int) { + var existential = existentialType.init() for _ in 0 ..< N * 10_000 { if !existential.mutateIt() { fatalError("expected true") @@ -512,8 +513,8 @@ func run_Mutating(withType: T.Type, numberOfTimes N: Int) { } } -func run_MutatingAndNonMutating(withType: T.Type, numberOfTimes N: Int) { - var existential = initExistential(withType: T.self) +func run_MutatingAndNonMutating(_ N: Int) { + var existential = existentialType.init() for _ in 0 ..< N * 10_000 { let _ = existential.doIt() if !existential.mutateIt() { @@ -522,10 +523,10 @@ func run_MutatingAndNonMutating(withType: T.Type, numberOfTimes } } -func run_Array_init(withType: T.Type, numberOfTimes N: Int) { +func run_Array_init(_ N: Int) { for _ in 0 ..< N * 20 { - blackHole(initExistentialArray(withType: T.self, count: 128)) + blackHole(Array(repeating: existentialType.init(), count: 128)) } } @@ -584,209 +585,6 @@ func run_ArrayConditionalShift(_ N: Int) { } } -// method.1x -public func run_method1xVal0(_ N: Int) { - run_method1x(withType: Val0.self, numberOfTimes: N) -} -public func run_method1xVal1(_ N: Int) { - run_method1x(withType: Val1.self, numberOfTimes: N) -} -public func run_method1xVal2(_ N: Int) { - run_method1x(withType: Val2.self, numberOfTimes: N) -} -public func run_method1xVal3(_ N: Int) { - run_method1x(withType: Val3.self, numberOfTimes: N) -} -public func run_method1xVal4(_ N: Int) { - run_method1x(withType: Val4.self, numberOfTimes: N) -} -public func run_method1xRef1(_ N: Int) { - run_method1x(withType: Ref1.self, numberOfTimes: N) -} -public func run_method1xRef2(_ N: Int) { - run_method1x(withType: Ref2.self, numberOfTimes: N) -} -public func run_method1xRef3(_ N: Int) { - run_method1x(withType: Ref3.self, numberOfTimes: N) -} -public func run_method1xRef4(_ N: Int) { - run_method1x(withType: Ref4.self, numberOfTimes: N) -} - -// method.2x -public func run_method2xVal0(_ N: Int) { - run_method2x(withType: Val0.self, numberOfTimes: N) -} -public func run_method2xVal1(_ N: Int) { - run_method2x(withType: Val1.self, numberOfTimes: N) -} -public func run_method2xVal2(_ N: Int) { - run_method2x(withType: Val2.self, numberOfTimes: N) -} -public func run_method2xVal3(_ N: Int) { - run_method2x(withType: Val3.self, numberOfTimes: N) -} -public func run_method2xVal4(_ N: Int) { - run_method2x(withType: Val4.self, numberOfTimes: N) -} -public func run_method2xRef1(_ N: Int) { - run_method2x(withType: Ref1.self, numberOfTimes: N) -} -public func run_method2xRef2(_ N: Int) { - run_method2x(withType: Ref2.self, numberOfTimes: N) -} -public func run_method2xRef3(_ N: Int) { - run_method2x(withType: Ref3.self, numberOfTimes: N) -} -public func run_method2xRef4(_ N: Int) { - run_method2x(withType: Ref4.self, numberOfTimes: N) -} - -// Pass.method.1x -public func run_Pass_method1xVal0(_ N: Int) { - run_Pass_method1x(withType: Val0.self, numberOfTimes: N) -} -public func run_Pass_method1xVal1(_ N: Int) { - run_Pass_method1x(withType: Val1.self, numberOfTimes: N) -} -public func run_Pass_method1xVal2(_ N: Int) { - run_Pass_method1x(withType: Val2.self, numberOfTimes: N) -} -public func run_Pass_method1xVal3(_ N: Int) { - run_Pass_method1x(withType: Val3.self, numberOfTimes: N) -} -public func run_Pass_method1xVal4(_ N: Int) { - run_Pass_method1x(withType: Val4.self, numberOfTimes: N) -} -public func run_Pass_method1xRef1(_ N: Int) { - run_Pass_method1x(withType: Ref1.self, numberOfTimes: N) -} -public func run_Pass_method1xRef2(_ N: Int) { - run_Pass_method1x(withType: Ref2.self, numberOfTimes: N) -} -public func run_Pass_method1xRef3(_ N: Int) { - run_Pass_method1x(withType: Ref3.self, numberOfTimes: N) -} -public func run_Pass_method1xRef4(_ N: Int) { - run_Pass_method1x(withType: Ref4.self, numberOfTimes: N) -} - -// Pass.method.2x -public func run_Pass_method2xVal0(_ N: Int) { - run_Pass_method2x(withType: Val0.self, numberOfTimes: N) -} -public func run_Pass_method2xVal1(_ N: Int) { - run_Pass_method2x(withType: Val1.self, numberOfTimes: N) -} -public func run_Pass_method2xVal2(_ N: Int) { - run_Pass_method2x(withType: Val2.self, numberOfTimes: N) -} -public func run_Pass_method2xVal3(_ N: Int) { - run_Pass_method2x(withType: Val3.self, numberOfTimes: N) -} -public func run_Pass_method2xVal4(_ N: Int) { - run_Pass_method2x(withType: Val4.self, numberOfTimes: N) -} -public func run_Pass_method2xRef1(_ N: Int) { - run_Pass_method2x(withType: Ref1.self, numberOfTimes: N) -} -public func run_Pass_method2xRef2(_ N: Int) { - run_Pass_method2x(withType: Ref2.self, numberOfTimes: N) -} -public func run_Pass_method2xRef3(_ N: Int) { - run_Pass_method2x(withType: Ref3.self, numberOfTimes: N) -} -public func run_Pass_method2xRef4(_ N: Int) { - run_Pass_method2x(withType: Ref4.self, numberOfTimes: N) -} - -// Mutating -public func run_MutatingVal0(_ N: Int) { - run_Mutating(withType: Val0.self, numberOfTimes: N) -} -public func run_MutatingVal1(_ N: Int) { - run_Mutating(withType: Val1.self, numberOfTimes: N) -} -public func run_MutatingVal2(_ N: Int) { - run_Mutating(withType: Val2.self, numberOfTimes: N) -} -public func run_MutatingVal3(_ N: Int) { - run_Mutating(withType: Val3.self, numberOfTimes: N) -} -public func run_MutatingVal4(_ N: Int) { - run_Mutating(withType: Val4.self, numberOfTimes: N) -} -public func run_MutatingRef1(_ N: Int) { - run_Mutating(withType: Ref1.self, numberOfTimes: N) -} -public func run_MutatingRef2(_ N: Int) { - run_Mutating(withType: Ref2.self, numberOfTimes: N) -} -public func run_MutatingRef3(_ N: Int) { - run_Mutating(withType: Ref3.self, numberOfTimes: N) -} -public func run_MutatingRef4(_ N: Int) { - run_Mutating(withType: Ref4.self, numberOfTimes: N) -} - -// MutatingAndNonMutating -public func run_MutatingAndNonMutatingVal0(_ N: Int) { - run_MutatingAndNonMutating(withType: Val0.self, numberOfTimes: N) -} -public func run_MutatingAndNonMutatingVal1(_ N: Int) { - run_MutatingAndNonMutating(withType: Val1.self, numberOfTimes: N) -} -public func run_MutatingAndNonMutatingVal2(_ N: Int) { - run_MutatingAndNonMutating(withType: Val2.self, numberOfTimes: N) -} -public func run_MutatingAndNonMutatingVal3(_ N: Int) { - run_MutatingAndNonMutating(withType: Val3.self, numberOfTimes: N) -} -public func run_MutatingAndNonMutatingVal4(_ N: Int) { - run_MutatingAndNonMutating(withType: Val4.self, numberOfTimes: N) -} -public func run_MutatingAndNonMutatingRef1(_ N: Int) { - run_MutatingAndNonMutating(withType: Ref1.self, numberOfTimes: N) -} -public func run_MutatingAndNonMutatingRef2(_ N: Int) { - run_MutatingAndNonMutating(withType: Ref2.self, numberOfTimes: N) -} -public func run_MutatingAndNonMutatingRef3(_ N: Int) { - run_MutatingAndNonMutating(withType: Ref3.self, numberOfTimes: N) -} -public func run_MutatingAndNonMutatingRef4(_ N: Int) { - run_MutatingAndNonMutating(withType: Ref4.self, numberOfTimes: N) -} - -// Array.init -public func run_Array_initVal0(_ N: Int) { - run_Array_init(withType: Val0.self, numberOfTimes: N) -} -public func run_Array_initVal1(_ N: Int) { - run_Array_init(withType: Val1.self, numberOfTimes: N) -} -public func run_Array_initVal2(_ N: Int) { - run_Array_init(withType: Val2.self, numberOfTimes: N) -} -public func run_Array_initVal3(_ N: Int) { - run_Array_init(withType: Val3.self, numberOfTimes: N) -} -public func run_Array_initVal4(_ N: Int) { - run_Array_init(withType: Val4.self, numberOfTimes: N) -} -public func run_Array_initRef1(_ N: Int) { - run_Array_init(withType: Ref1.self, numberOfTimes: N) -} -public func run_Array_initRef2(_ N: Int) { - run_Array_init(withType: Ref2.self, numberOfTimes: N) -} -public func run_Array_initRef3(_ N: Int) { - run_Array_init(withType: Ref3.self, numberOfTimes: N) -} -public func run_Array_initRef4(_ N: Int) { - run_Array_init(withType: Ref4.self, numberOfTimes: N) -} - // Local Variables: // eval: (read-only-mode 1) // End: diff --git a/benchmark/single-source/ExistentialPerformance.swift.gyb b/benchmark/single-source/ExistentialPerformance.swift.gyb index ac4604e258eb3..4e6287168d8d2 100644 --- a/benchmark/single-source/ExistentialPerformance.swift.gyb +++ b/benchmark/single-source/ExistentialPerformance.swift.gyb @@ -24,9 +24,9 @@ let ta: [BenchmarkCategory] = [.api, .Array] %{ Setup = """ - let existential = initExistential(withType: T.self) - let existential2 = initExistential(withType: T.self) - var existential = initExistential(withType: T.self) + let existential = existentialType.init() + let existential2 = existentialType.init() + var existential = existentialType.init() let existentialArray = grabArray() var existentialArray = grabArray() """.splitlines() @@ -65,7 +65,7 @@ Workloads = [ } """), ('Array.init', Setup[0], '20', """ - blackHole(initExistentialArray(withType: T.self, count: 128)) + blackHole(Array(repeating: existentialType.init(), count: 128)) """), ('Array.method.1x', Setup[4], '100', """ for elt in existentialArray { @@ -109,8 +109,8 @@ Vals = ['Val' + str(i) for i in range(0, 5)] Names = [(group + '.' + variant, group, variant) for (group, _, _, _) in Workloads for variant in Refs + Vals] -def typed_variants(name): - return 'Array' not in name or 'Array.init' in name +def create_array(group): + return 'Array' in group and 'Array.init' not in group import re @@ -127,11 +127,9 @@ def run_function_name(benchmark_name): public let ExistentialPerformance: [BenchmarkInfo] = [ % for (Name, Group, Variant) in Names: BenchmarkInfo(name: "Existential.${Name}", - runFunction: ${ - run_function_name(Name) if typed_variants(Group) else - run_function_name(Group)}, tags: ${ - 'ta' if 'Array' in Name else 't'}${ - (', setUpFunction: ca' + Variant) if not typed_variants(Group) else '' }), + runFunction: ${run_function_name(Group) + }, tags: ${ 'ta' if 'Array' in Name else 't' + }, setUpFunction: ${ ('ca' if create_array(Group) else 'et') + Variant }), % end ] @@ -139,7 +137,7 @@ public let ExistentialPerformance: [BenchmarkInfo] = [ // these are setup functions that **create array** for each variant type. var array: [Existential]! func ca(_: T.Type) { - array = initExistentialArray(withType: T.self, count: 128) + array = Array(repeating: T(), count: 128) } % for Variant in Vals + Refs: func ca${Variant}() { ca(${Variant}.self) } @@ -156,6 +154,12 @@ func grabArray() -> [Existential] { // transfer array ownership to caller return array! } +// `setUpFunctions` that determine which existential type will be tested +var existentialType: Existential.Type! +% for Variant in Vals + Refs: +func et${Variant}() { existentialType = ${Variant}.self } +% end + protocol Existential { init() func doIt() -> Bool @@ -224,17 +228,6 @@ struct ${V} : Existential { % end -@inline(never) -func initExistential(withType: T.Type) -> Existential { - return T() -} - -@inline(never) -func initExistentialArray(withType: T.Type, count c: Int) - -> [Existential] { - return [T](repeating: T(), count: c) -} - @inline(never) func passExistentialTwiceOneMethodCall(_ e0: Existential, _ e1: Existential) -> Bool { @@ -246,31 +239,14 @@ func passExistentialTwiceTwoMethodCalls(_ e0: Existential, _ e1: Existential) -> Bool { return e0.doIt() && e1.doIt() && e0.reallyDoIt() && e1.reallyDoIt() } -%{ -def type(name): - return ( - '(withType: T.Type, numberOfTimes' if typed_variants(name) - else '(_') -}% % for (group, setup, multiple, workload) in Workloads: ${""" -func {0}{4} N: Int) {{ +func {0}(_ N: Int) {{ {1} for _ in 0 ..< N * {2} {{{3} }} -}}""".format(run_function_name(group), setup, multiple, workload, type(group))} +}}""".format(run_function_name(group), setup, multiple, workload)} % end -% for (Group, _, _, _) in Workloads: -% if typed_variants(Group): -// ${Group} -% for Variant in Vals + Refs: -public func ${run_function_name(Group + '.' + Variant)}(_ N: Int) { - ${run_function_name(Group)}(withType: ${Variant}.self, numberOfTimes: N) -} -% end - -% end -% end // ${'Local Variables'}: // eval: (read-only-mode 1) // End: From 0ac591e27b8d14d2452abac9ad707d834678700a Mon Sep 17 00:00:00 2001 From: Pavol Vaskovic Date: Sat, 17 Nov 2018 15:37:20 +0100 Subject: [PATCH 10/12] [benchmark] Add .existential BenchmarkCategory --- benchmark/single-source/ExistentialPerformance.swift | 4 ++-- benchmark/single-source/ExistentialPerformance.swift.gyb | 4 ++-- benchmark/utils/TestsUtils.swift | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/benchmark/single-source/ExistentialPerformance.swift b/benchmark/single-source/ExistentialPerformance.swift index 7cfec9f0c311b..d354cbec371f2 100644 --- a/benchmark/single-source/ExistentialPerformance.swift +++ b/benchmark/single-source/ExistentialPerformance.swift @@ -18,8 +18,8 @@ import TestsUtils -let t: [BenchmarkCategory] = [] -let ta: [BenchmarkCategory] = [.api, .Array] +let t: [BenchmarkCategory] = [.existential] +let ta: [BenchmarkCategory] = [.api, .Array, .existential] public let ExistentialPerformance: [BenchmarkInfo] = [ BenchmarkInfo(name: "Existential.method.1x.Ref1", diff --git a/benchmark/single-source/ExistentialPerformance.swift.gyb b/benchmark/single-source/ExistentialPerformance.swift.gyb index 4e6287168d8d2..e574732531dc2 100644 --- a/benchmark/single-source/ExistentialPerformance.swift.gyb +++ b/benchmark/single-source/ExistentialPerformance.swift.gyb @@ -19,8 +19,8 @@ import TestsUtils -let t: [BenchmarkCategory] = [] -let ta: [BenchmarkCategory] = [.api, .Array] +let t: [BenchmarkCategory] = [.existential] +let ta: [BenchmarkCategory] = [.api, .Array, .existential] %{ Setup = """ diff --git a/benchmark/utils/TestsUtils.swift b/benchmark/utils/TestsUtils.swift index dc28988f8e58a..3445c1eb32c9c 100644 --- a/benchmark/utils/TestsUtils.swift +++ b/benchmark/utils/TestsUtils.swift @@ -25,7 +25,7 @@ public enum BenchmarkCategory : String { case sdk case runtime, refcount, metadata // Other general areas of compiled code validation. - case abstraction, safetychecks, exceptions, bridging, concurrency + case abstraction, safetychecks, exceptions, bridging, concurrency, existential // Algorithms are "micro" that test some well-known algorithm in isolation: // sorting, searching, hashing, fibonaci, crypto, etc. From b61a63d16a043d6093b8657d48ca3dddda48838a Mon Sep 17 00:00:00 2001 From: Pavol Vaskovic Date: Thu, 7 Feb 2019 15:14:32 +0100 Subject: [PATCH 11/12] [benchmark] Add docs & adjust loop multipliers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumping up the multipliers to get above 20 μs runtime. --- .../single-source/ExistentialPerformance.swift | 15 ++++++++++++--- .../ExistentialPerformance.swift.gyb | 15 ++++++++++++--- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/benchmark/single-source/ExistentialPerformance.swift b/benchmark/single-source/ExistentialPerformance.swift index d354cbec371f2..78c05b03254e6 100644 --- a/benchmark/single-source/ExistentialPerformance.swift +++ b/benchmark/single-source/ExistentialPerformance.swift @@ -18,6 +18,15 @@ import TestsUtils +// The purpose of these benchmarks is to evaluate different scenarios when +// moving the implementation of existentials (protocol values) to heap based +// copy-on-write buffers. +// +// The performance boost of `Ref4` vs `Ref3` is expected because copying the +// existential only involves copying one reference of the heap based +// copy-on-write buffer (outline case) that holds the struct vs copying the +// individual fields of the struct in the inline case of `Ref3`. + let t: [BenchmarkCategory] = [.existential] let ta: [BenchmarkCategory] = [.api, .Array, .existential] @@ -525,7 +534,7 @@ func run_MutatingAndNonMutating(_ N: Int) { func run_Array_init(_ N: Int) { - for _ in 0 ..< N * 20 { + for _ in 0 ..< N * 100 { blackHole(Array(repeating: existentialType.init(), count: 128)) } } @@ -565,7 +574,7 @@ func run_ArrayMutating(_ N: Int) { func run_ArrayShift(_ N: Int) { var existentialArray = grabArray() - for _ in 0 ..< N * 10 { + for _ in 0 ..< N * 25 { for i in 0 ..< existentialArray.count-1 { existentialArray.swapAt(i, i+1) } @@ -574,7 +583,7 @@ func run_ArrayShift(_ N: Int) { func run_ArrayConditionalShift(_ N: Int) { var existentialArray = grabArray() - for _ in 0 ..< N * 10 { + for _ in 0 ..< N * 25 { for i in 0 ..< existentialArray.count-1 { let curr = existentialArray[i] if curr.doIt() { diff --git a/benchmark/single-source/ExistentialPerformance.swift.gyb b/benchmark/single-source/ExistentialPerformance.swift.gyb index e574732531dc2..bb8380924b8cc 100644 --- a/benchmark/single-source/ExistentialPerformance.swift.gyb +++ b/benchmark/single-source/ExistentialPerformance.swift.gyb @@ -19,6 +19,15 @@ import TestsUtils +// The purpose of these benchmarks is to evaluate different scenarios when +// moving the implementation of existentials (protocol values) to heap based +// copy-on-write buffers. +// +// The performance boost of `Ref4` vs `Ref3` is expected because copying the +// existential only involves copying one reference of the heap based +// copy-on-write buffer (outline case) that holds the struct vs copying the +// individual fields of the struct in the inline case of `Ref3`. + let t: [BenchmarkCategory] = [.existential] let ta: [BenchmarkCategory] = [.api, .Array, .existential] @@ -64,7 +73,7 @@ Workloads = [ fatalError("expected true") } """), - ('Array.init', Setup[0], '20', """ + ('Array.init', Setup[0], '100', """ blackHole(Array(repeating: existentialType.init(), count: 128)) """), ('Array.method.1x', Setup[4], '100', """ @@ -88,12 +97,12 @@ Workloads = [ } } """), - ('Array.Shift', Setup[5], '10', """ + ('Array.Shift', Setup[5], '25', """ for i in 0 ..< existentialArray.count-1 { existentialArray.swapAt(i, i+1) } """), - ('Array.ConditionalShift', Setup[5], '10', """ + ('Array.ConditionalShift', Setup[5], '25', """ for i in 0 ..< existentialArray.count-1 { let curr = existentialArray[i] if curr.doIt() { From 776ace067640849219d507e8162c8dd6aa0b9d1d Mon Sep 17 00:00:00 2001 From: Pavol Vaskovic Date: Tue, 12 Feb 2019 21:17:31 +0100 Subject: [PATCH 12/12] [benchmark] Disable ExistentialPerformance MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Don’t run the ExistentialPerformance benchmarks as part of the pre-commit suite. --- benchmark/single-source/ExistentialPerformance.swift | 4 ++-- benchmark/single-source/ExistentialPerformance.swift.gyb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/benchmark/single-source/ExistentialPerformance.swift b/benchmark/single-source/ExistentialPerformance.swift index 78c05b03254e6..03b260a28c208 100644 --- a/benchmark/single-source/ExistentialPerformance.swift +++ b/benchmark/single-source/ExistentialPerformance.swift @@ -27,8 +27,8 @@ import TestsUtils // copy-on-write buffer (outline case) that holds the struct vs copying the // individual fields of the struct in the inline case of `Ref3`. -let t: [BenchmarkCategory] = [.existential] -let ta: [BenchmarkCategory] = [.api, .Array, .existential] +let t: [BenchmarkCategory] = [.skip] +let ta: [BenchmarkCategory] = [.api, .Array, .skip] public let ExistentialPerformance: [BenchmarkInfo] = [ BenchmarkInfo(name: "Existential.method.1x.Ref1", diff --git a/benchmark/single-source/ExistentialPerformance.swift.gyb b/benchmark/single-source/ExistentialPerformance.swift.gyb index bb8380924b8cc..567ce6b785a5f 100644 --- a/benchmark/single-source/ExistentialPerformance.swift.gyb +++ b/benchmark/single-source/ExistentialPerformance.swift.gyb @@ -28,8 +28,8 @@ import TestsUtils // copy-on-write buffer (outline case) that holds the struct vs copying the // individual fields of the struct in the inline case of `Ref3`. -let t: [BenchmarkCategory] = [.existential] -let ta: [BenchmarkCategory] = [.api, .Array, .existential] +let t: [BenchmarkCategory] = [.skip] +let ta: [BenchmarkCategory] = [.api, .Array, .skip] %{ Setup = """