Saturday
14Jul2007
Any Amount of Computation is Worth It
Saturday, July 14, 2007 at 04:01PM
There are very few specific instructions I can remember being given during my Computer Science course at University. However, one stands out and has stayed with me in the years since:
It's not an exact quote, and my attribution to Dr. Peter Dickman might be nothing more than a hazy recollection, but it's still golden advice.
I've been working on some additions to Blake Seely's MUPhotoView class. In particular, I'm implementing support for drag-reordering the photos in the view. Since the view has to track the user's drag in order to draw the insertion point, it's a performance-critical operation. I don't know about you, dear reader, but I hate stuttery drags.
The difference between calling `[photoView setNeedsDisplay: YES]` and calling `[photoView setNeedsDisplay: myUnionOfDamagedRects]` is remarkable.
"Any amount of computation is worth it, to avoid having to draw to the screen."
It's not an exact quote, and my attribution to Dr. Peter Dickman might be nothing more than a hazy recollection, but it's still golden advice.
I've been working on some additions to Blake Seely's MUPhotoView class. In particular, I'm implementing support for drag-reordering the photos in the view. Since the view has to track the user's drag in order to draw the insertion point, it's a performance-critical operation. I don't know about you, dear reader, but I hate stuttery drags.
The difference between calling `[photoView setNeedsDisplay: YES]` and calling `[photoView setNeedsDisplay: myUnionOfDamagedRects]` is remarkable.
Reader Comments (3)
Here here! And I totally agree - never draw if you don't have to.
see this http://fff.to/B7T
It is rather interesting for me to read that post. Thanks for it. I like such themes and anything connected to this matter. I definitely want to read a bit more soon.