What determines SHA256 performance on different types of hardware? I know the answers to many questions on here briefly touch on this point, but I'd like to get a consolidated answer that really touches on the key differences between different types of hardware which allows SHA256 to perform better, instead of the less-related tangents other questions discuss. While my immediate concern is with Bitcoin, I know that some other crypto-currencies use different algorithms, so feel free to reference them if it helps make your point.


Why does the Bitcoin hash algorithm, SHA256, perform better on different types of hardware? What makes an ASIC/FPGA capable of computing more H/s than a GPU, a GPU than a CPU, etc?
What is "the complexity of the cores?" Is this a reference to the number of cores, or to the actual die complexity? In both cases, why is this not a factor in SHA256 performance? Referencing David Perry's answer here:



  It's important to note, by the way, that the one thing that won't buy you more hashes per second is the complexity of the cores. This is why Nvidia may make great cards for gaming purposes, but they suck for mining - games make better use of exotic new instructions than SHA256 does.



Can SHA256 be optimized at all to perform better on a per-architecture basis? Can any optimizations be made to the double-hashing process?
Mining performance can be viewed as consisting of two factors. One is the total resources available. The other is what fraction of those resources you can usefully apply to mining.

ASICs and FPGAs excel at mining because you can effectively use a very high fraction of their available resources for mining. CPUs are terrible at mining because a huge fraction of their resources are useless for mining -- they're optimized for memory access, decision making, floating point math, and many other things that don't help with mining at all.

The "complexity of the cores" refers to how sophisticated the operations that the cores can do are. This doesn't help with mining, which only requires very simple operations, and thus just increases the fraction of the resources available that you can't use for mining.

SHA256 can be heavily optimized for every architecture. In the early days of mining, there was a huge "arms race" to micro-optimize mining for various architectures.