Setting the online status of the CPU core just tells the process scheduler to not use that core for any processes. On a hardware level, the core is simply sitting idle (doing NOP
s), but still powered. While this will save power, it won't save nearly as much power as putting the computer to sleep. Why?
Well, your motherboard, CPU, and GPU are all still running! When you put the computer to sleep, all of these components are literally unpowered, and just enough power to keep your RAM alive is used (on the order of a couple watts).
Again, while I agree it will save power, even shutting off half of your CPU cores may halve the power consumption of the processor (although in reality, you may only save 30-40% since those cores still need to sit idle), but this is far from the only component in the system using power. Even if you save 50W by doing this, you're entire computer is still drawing far more power than mere watts in sleep mode.
Final thoughts: While I agree this is a great idea in practice, this is also why many CPU manufacturers include dynamic frequency scaling (Intel's "Speed Step"), with support for Linux. You may yield better overall performance, as well as power efficiency, by setting these frequencies more appropriately for your needs. This can be done in both hardware (BIOS settings), as well as software (the Linux kernel allows you to modify some CPU parameters, see the link I posted above or this website for details).
This works, because the following is the generic equation for power consumption of a CMOS circuit:
P = CV2f, where C = capacitance (assume fixed), V = voltage, and f = frequency.
Thus, dividing the frequency by 2 will half the original power consumption. Dividing the voltage by 2 will reduce power consumption to 1/4 the original.