Two times to shorten your stroke
Many players develop strokes that are too short, which costs them both power and control. (They lose control because to generate power they have to jerk into the shot instead of a smoother progression.) But there are two times when players should often shorten their strokes.
The first is when returning serves. The key here is control, so you don't need a lot of power. A shorter stroke also allows you to wait a little longer before swinging, giving you more time to read the spin. It also is easier to use a short stroke over the table against short serves. You can shorten your stroke a bit when looping a deep serve as well, as long as you don't get too soft. The basic rule is loop only as fast as needed to keep the opponent from making a strong counter-attack. (Of course, if you read the serve well - and know you have read the serve well - then you can put a little more on the loop. At higher levels many players often overpower the service spin with their own huge topspin, and so they do not shorten their stroke.)
The second time is against a loop. If you are blocking, you don't need to put too much force into it since the topspin will jump off your racket already. If you smash a loop, then you should also shorten your stroke. This allows you to wait as long as possible before starting your forward swing, and it makes timing easier against a ball that's jumping off the table with topspin. Unlike a normal smash, where you can get away with hitting the ball a bit late, against a loop if you are late smashing, the ball jumps away from you. The shorter stroke makes it easier to take it on the rise or top of the bounce.
You also might shorten your stroke in a very fast rally or against a smash, but here you are doing it because you are forced to, as opposed to by choice.
How To Prepare for Match and Win! - Mental Readiness