After some time off, I play much better the next day after practice than if I were to play immediately after practice.
I've had the same experience with code. I bang my head against my desk trying to do something, go to bed, and do the thing in the first hour of my day. It's like magic.