A tiny package to measure code execution time. Only 20 lines of code

Measure

⏲ A tiny package to measure code execution time.

Measure.start("create-user")
let user = User()
Measure.finish("create-user")

Console

// ⏲ Measure [create-user]: 0.00521 sec.

Async

Measure.start("request")
let url = URL(string: "https://httpbin.org/get")!
URLSession.shared.dataTask(with: url) { _, _, _ in
    if Measure.finish("request") > 10 {
        print("Too long request")
    }
}.resume()

Swift Package Manager

https://github.com/mezhevikin/Measure.git

GitHub

View Github