Signal-iOS/SignalMessaging/utils/Bench.swift
Michael Kirk dfd628250d Gallery performance
- [x] share uiDatabaseConnection to share cache
- [x] increase cache size
- [x] load less initially
- [x] lazy loading
  - [x] slider view
  - [x] tile view

// FREEBIE
2018-03-19 14:22:03 -04:00

22 lines
498 B
Swift

//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
import Foundation
public func BenchAsync(title: String, block: (() -> Void) -> Void) {
let startTime = CFAbsoluteTimeGetCurrent()
block {
let timeElapsed = CFAbsoluteTimeGetCurrent() - startTime
print("[Bench] title: \(title), duration: \(timeElapsed)")
}
}
public func Bench(title: String, block: () -> Void) {
BenchAsync(title: title) { finish in
block()
finish()
}
}