【发布时间】:2023-03-23 09:59:02
【问题描述】:
我最近尝试回答一个问题here,该问题基于速度,需要某种方法来衡量各种操作的工作时间。我偶尔看到人们提到不同编码方法的速度,我想知道,在 Objective-C 中衡量速度性能的最佳方法是什么?
这是我一直在使用的:
NSDate* operation = [NSDate date];
// Code you want to measure goes here
NSLog(@"Time: %f", -[operation timeIntervalSinceNow]);
这是一种可接受且有用的测量方法吗?是否有更好的替代方法?
【问题讨论】:
标签: ios objective-c performance