check first with timestamp?
do i save some time when having a timestamp and o开发者_JS百科nly ask the operation isCancelled every 50 msec?
isCancelled
is a pretty simple BOOL
flag, so checking it on each iteration of even a very tight loop doesn't incur a real performance penalty. I think you'll find the overhead of setting up a mechanism to check isCancelled
periodically will actually perform worse.
精彩评论