Question

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?

Was it helpful?

Solution

I don't have any knowledge of the internals, but I would be very surprised if incrementBy were not the equivalent of

[self setDoubleValue:[self doubleValue] + delta];

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.

OTHER TIPS

I suspect that NSProgressIndicator runs smoother when its value is updated through incrementBy as compared to setDoubleValue.

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 type NSUInteger that is initially zero.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top