NSProgressIndicator 的平滑度:incrementBy 与 setDoubleValue
我怀疑 NSProgressIndicator通过incrementBy更新其值时运行更流畅。
有谁知道这两种更新其值的方法之间是否有真正的区别?
I suspect that NSProgressIndicator runs smoother when its value is updated through incrementBy as compared to setDoubleValue.
Does anyone know if there's any real difference between the two methods of updating its value?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我对内部结构没有任何了解,但如果incrementBy不等同于
当然,我会感到非常惊讶,因为它可以访问内部状态,所以它可能会跳过所有方法调用。但是实际渲染的行为屏幕上的像素几乎肯定会压倒这两种方法之间任何细微的性能差异。
I don't have any knowledge of the internals, but I would be very surprised if incrementBy were not the equivalent of
Of course, since it has access to internal state, it could presumably skip all the method calls.But the act of actually rendering pixels to the screen almost certainly overpowers any minor performance difference between the two methods.
在 macOS 10.14 上没有区别。当我将
maxValue
设置为 1000,然后让计时器每 100 毫秒调用一个方法时,无论该方法是否始终调用[self.progressincrementBy:1]
,它看起来都是相同的或 [self.progress setDoubleValue:self.step++],其中 step 是初始为零的NSUInteger
类型的实例变量。Makes no difference on macOS 10.14. When I set the
maxValue
to 1000 and then have a timer call a method every 100 ms, it looks identical, whether the method always calls[self.progress incrementBy:1]
or[self.progress setDoubleValue:self.step++]
, with step being an instance variable of typeNSUInteger
that is initially zero.