Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Objective-C
- CFTimeInterval startTime = CACurrentMediaTime();
- // perform some action
- CFTimeInterval elapsedTime = CACurrentMediaTime() - startTime;
- Swift
- let startTime = CACurrentMediaTime()
- // perform some action
- let elapsedTime = CACurrentMediaTime() - startTime
- Benchmark
- extern uint64_t dispatch_benchmark(size_t count, void (^block)(void));
- uint64_t t = dispatch_benchmark(iterations, ^{
- @autoreleasepool {
- ...
- }
- });
- NSLog(@"Avg. Runtime: %llu ns", t);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement