I've never really heard of optimization on a high level programming language. In assembly perhaps.
So I would expect that X = 0 is more efficent that X = Y * 0;
The issue lies with memory access and compution. X = 0 accesses memory once where as the X = Y * 0 access memory twice and performs a calculation. If you look at the assembly commands to carry out these operations, you'll see the actual costs involved.