Actually, even if you made a desktop PC with hardware having the same model as the one of a laptop, it would differ at hardwarelevel. Both desktop and laptop PCs have to be kept cool, or you'd probably end frying french fries over your CPU, eventually turning your PC in a door stop. Laptop PCs have very small space in the case so the CPU cooler will have a very bad time cooling the CPU. This is why laptop CPUs are made so they always stay on alert for any heating that may damage the hardware. This difference is made in the circuitry which always checks the temperature (aside from the tens or hundreds of softwares provided to automatically decrease CPU usage/power and consequently heating). If there's too much heating, even if the laptop has a huge load to run, it'll be limited for hardware's safety. Now, as suggested before, desktop PCs also use much more power - because they have where to get it from. A desktop PC is connected to the powerline 100% of the time so the baddest thing could happen is that power gets missing. Laptops instead only have a modest battery which will provide sufficient power for some time, not forever. Electronic components work fine when they have good power supply, but when laptop's battery starts getting low, electronic components also start getting low on performance. On some old PCs people could notice the audio volume getting worst when the battery was getting low. Hopefully, we're not having those issues anymore, but still, the problem persists. To run at full speed some electronic components must use more power or they'll fallback to a lower speed. Hard drives will run at lower RPMs, RAM will run at a lower read/write speed and the CPU itself will be the first slowing down. As a counterpart of this, using more power (assuming it's available somehow) means more heating, so the temperature control will still limit speeds based on heating. An identical desktop and laptop CPU, compared at the same temperature and same load on the same hardware, have different performances where the one on the laptop is fairly behind the desktop one.
Now don't get disappointed by this, it's just the nature of the desktop and laptop PCs to be this way for (mostly) physical reasons. Anyway, even laptops have huge performances that could reach desktop ones (just make sure you spend some money on it
), but if you have to choose between a desktop and a laptop because of performance - definitely go for desktop. Portability though is a huge benefit of laptops, it may save you time and space, and you may keep you laptop with you at home and at work - you could not do the same with a desktop, could you?