Boy, have I got you fooled!
Anyway, it allows an effect that is running to end faster if the user changes a UI control or cancels an effect. It is not necessary, but sometimes it can make your UI more responsive.
I put it in the Y loop so it only checks once per row. If your effect is especially slow, you might want to move it to the X loop. I did that ONCE in all my plugins.