I prefer homework over whiteboard or any on-site coding challenges. I'm really bad under pressure.
But I only do homework after the on-site interview, so I know I really want to work there and they have some "skin in the game" too not just shotgunning random candidates that they never actually planning to hire.
I'd rather do homework before the on-site interview - then I can be confident of my skills and their opinion going in. But then if they don't trust that the homework was done without cheating, it was all a waste of time.
But I only do homework after the on-site interview, so I know I really want to work there and they have some "skin in the game" too not just shotgunning random candidates that they never actually planning to hire.
Also, anything over 3 hours is a no go.