Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2015
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. Objective-C
  2. CFTimeInterval startTime = CACurrentMediaTime();
  3. // perform some action
  4. CFTimeInterval elapsedTime = CACurrentMediaTime() - startTime;
  5.  
  6.  
  7. Swift
  8. let startTime = CACurrentMediaTime()
  9. // perform some action
  10. let elapsedTime = CACurrentMediaTime() - startTime
  11.  
  12. Benchmark
  13. extern uint64_t dispatch_benchmark(size_t count, void (^block)(void));
  14. uint64_t t = dispatch_benchmark(iterations, ^{
  15. @autoreleasepool {
  16. ...
  17. }
  18. });
  19. NSLog(@"Avg. Runtime: %llu ns", t);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement