Skip to content

Commit d6a0268

Browse files
authored
Merge pull request #64393 from glessard/rdar106656555-slowtest
[test] fix compilation performance issues in validation-test/stdlib/UnsafeBufferPointerSlices.swift
2 parents fd84ae9 + a441756 commit d6a0268

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

validation-test/stdlib/UnsafeBufferPointerSlices.swift

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// RUN: %target-run-simple-swift
22
// REQUIRES: executable_test
3-
4-
// rdar://106656555
5-
// REQUIRES: rdar106656555
3+
// END.
64

75
import StdlibUnittest
86

@@ -47,14 +45,14 @@ UnsafeMutableBufferPointerSliceTests.test(
4745
$0[i].0 += 1
4846
}
4947
}
50-
expectEqual(mb.reduce(0,+), t+5)
48+
expectEqual(mb.reduce(Int.zero,+), t+5)
5149
let sb: Slice = mb[...]
5250
sb.withMemoryRebound(to: (UInt, UInt).self) {
5351
for i in $0.indices {
5452
$0[i].1 -= 1
5553
}
5654
}
57-
expectEqual(mb.reduce(0,+), t)
55+
expectEqual(mb.reduce(Int.zero,+), t)
5856
return true
5957
}
6058
expectNotNil(r)
@@ -89,14 +87,14 @@ UnsafeMutableBufferPointerSliceTests.test(
8987
var (it, ct) = mb.initialize(from: (0..<c).map(String.init))
9088
expectNil(it.next())
9189
expectEqual(ct, c)
92-
expectEqual(mb.compactMap(Int.init).reduce(0,+), c*(c-1)/2)
90+
expectEqual(mb.last.map(Int.init), c-1)
9391
var rb = mb.deinitialize()
9492
expectEqual(rb.count, c*MemoryLayout<String>.stride)
9593

9694
(it, ct) = mb[...].initialize(from: (0..<c).map(String.init))
9795
expectNil(it.next())
9896
expectEqual(ct, c)
99-
expectEqual(mb.compactMap(Int.init).reduce(0,+), c*(c-1)/2)
97+
expectEqual(mb.last.map(Int.init), c-1)
10098
rb = mb[...].deinitialize()
10199
expectEqual(rb.count, c*MemoryLayout<String>.stride)
102100
}
@@ -110,13 +108,13 @@ UnsafeMutableBufferPointerSliceTests.test(
110108

111109
var ct = mb.initialize(fromContentsOf: (1...c).map(String.init))
112110
expectEqual(ct, c)
113-
expectEqual(mb.compactMap(Int.init).reduce(0,+), c*(c+1)/2)
111+
expectEqual(mb.last.map(Int.init), c)
114112
var rb = mb.deinitialize()
115113
expectEqual(rb.count, c*MemoryLayout<String>.stride)
116114

117115
ct = mb[...].initialize(fromContentsOf: (1...c).map(String.init))
118116
expectEqual(ct, c)
119-
expectEqual(mb.compactMap(Int.init).reduce(0,+), c*(c+1)/2)
117+
expectEqual(mb.last.map(Int.init), c)
120118
rb = mb[...].deinitialize()
121119
expectEqual(rb.count, c*MemoryLayout<String>.stride)
122120
}
@@ -158,7 +156,7 @@ UnsafeMutableBufferPointerSliceTests.test(
158156
$0.update(fromContentsOf: (0..<c).map(String.init))
159157
}
160158
expectEqual(i, c)
161-
expectEqual(a.compactMap(Int.init).reduce(0,+), c*(c-1)/2)
159+
expectEqual(a.last.map(Int.init), c-1)
162160

163161
i = b.withContiguousMutableStorageIfAvailable {
164162
$0[...].update(fromContentsOf: (0..<c).map(String.init))

0 commit comments

Comments
 (0)