August 21, 2009
Photoshop & 64-bit registers
When reading about the advantages of 64-bit computing, you’ll sometimes hear that 64-bit chips offer more processor registers, and that using these registers will make apps faster. As I wrote last year when revealing Adobe’s 64-plans for Photoshop, PS does see a slight performance gain in 64-bit mode:
In our testing, when the app isn’t using a large data set (one that would otherwise require memory swapping), the speedup due to running in 64-bit mode is around 8-12%.
I asked some of the senior Photoshop engineers for background on why the impact of extra registers is pretty low.
“Most of the code we’ve identified as performance bottlenecks was long ago optimized, and in some cases hand-optimized,” replied Jon Clauson. “Such code really doesn’t get any faster because the processor/compiler has more registers to play with. We were happy we saw a general 8-12%.” He also noted that in many cases, Photoshop is not processor-bound, but rather memory bandwidth-bound.
Photoshop architect Russell Williams offered a bit longer answer:
Much of the performance-critical code is tuned not just for few general-purpose registers, but to use SSE, and those registers don’t change size with the move to 64 bits: SSE registers are still 128 bits.
The speedup on compiled C code when going from 32 to 64 bits on Intel varies widely depending on how much the compiler needs those extra registers and how much of the cache is taken up by pointers and bigger ints. Even when it looks like you ought to be getting a bigger win because of the extra registers, the win is less than you’d think because of the heavy hardware and compiler emphasis put on optimizing the loads and stores generated by temporary register spillage. (They’ve been trying to minimize the impact of that limited register set for a long time.)
Russell also pointed out some ExtremeTech benchmarks showing a mixed bag for running real-world apps in 32- vs. 64-bit mode.
Again, to be clear, none of this means that 64-bit isn’t great. It is. It’s just not some magic can of go-fast juice.