Skip to content

Commit c5a215d

Browse files
committed
Remove legacy testLoaderOverallPerformance
1 parent e1e9588 commit c5a215d

File tree

2 files changed

+9
-21
lines changed

2 files changed

+9
-21
lines changed

Sources/Nuke/Caching/Cache.swift

+9-1
Original file line numberDiff line numberDiff line change
@@ -198,16 +198,24 @@ final class Cache<Key: Hashable, Value>: @unchecked Sendable {
198198
return closure()
199199
}
200200

201-
private struct Entry {
201+
private class Entry {
202202
let value: Value
203203
let key: Key
204204
let cost: Int
205205
let expiration: Date?
206+
206207
var isExpired: Bool {
207208
guard let expiration else {
208209
return false
209210
}
210211
return expiration.timeIntervalSinceNow < 0
211212
}
213+
214+
init(value: Value, key: Key, cost: Int, expiration: Date?) {
215+
self.value = value
216+
self.key = key
217+
self.cost = cost
218+
self.expiration = expiration
219+
}
212220
}
213221
}

Tests/NukePerformanceTests/ImagePipelinePerformanceTests.swift

-20
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,6 @@ class ImagePipelinePerfomanceTests: XCTestCase {
1212
func testLoaderOverallPerformance() {
1313
let pipeline = makePipeline()
1414

15-
let requests = (0...5000).map { ImageRequest(url: URL(string: "http://test.com/\($0)")) }
16-
let callbackQueue = DispatchQueue(label: "testLoaderOverallPerformance")
17-
measure {
18-
var finished: Int = 0
19-
let semaphore = DispatchSemaphore(value: 0)
20-
for request in requests {
21-
pipeline.loadImage(with: request, progress: nil) { _ in
22-
finished += 1
23-
if finished == requests.count {
24-
semaphore.signal()
25-
}
26-
}
27-
}
28-
semaphore.wait()
29-
}
30-
}
31-
32-
func testAsyncAwaitPerformance() {
33-
let pipeline = makePipeline()
34-
3515
let requests = (0...5000).map { ImageRequest(url: URL(string: "http://test.com/\($0)")) }
3616

3717
measure {

0 commit comments

Comments
 (0)