With the advent of Steam landing on Linux drawing closer, Windows vs. Linux comparisons will become an inevitability. Although Valve's effort to port Steam over to Linux fans is still a work in progress, some onlookers may be surprised at the results thus far: Left 4 Dead 2 runs up to 20 percent faster in Ubuntu (OpenGL) than it does under Windows 7 (DirectX). In Direct3D mode, L4D2 hit 270.6 FPS on Windows while Ubuntu nailed a respectable 315 FPS.
Now, before readers begin praising and criticizing Valve's discovery, let us consider the details.
First, here are Valve's testbed specs: an Intel Core i7 3930k, 32GB RAM and a Nvidia GeForce GTX 680. The Linux testbed is running Ubuntu 12.04 (32-bit) while Windows relies on Windows 7 SP1 (64-bit). It's interesting to point out that this is very high-end hardware for an aging game (released in 2009), but probably doesn't bear any criticial consequences on the results.
During internal testing, Valve claimed working with Linux and OpenGL actually helped developers improve L4D2's OpenGL performance under Windows. Although Ubuntu still maintained its edge, programmers were able to squeeze 303.4 FPS with OpenGL under Windows following some modifications. Although we can only reserve judgement for this scenario specifically, the open graphics standard actually performed faster than Microsoft's own graphics API on Windows. Fascinating.
Since Source, the engine which powers Valve's games, has had an entire decade to mature on Windows – and the unfinished Linux port has only been in existence for a few months – the favored performance delivered by OpenGL would seem unlikely. So, a poignant question to ask is: Why is Left 4 Dead 2 faster on Linux?
For starters, developers gave props to Linux for its kernel efficiency. Valve also touched upon OpenGL with its praise, claiming their analysis showed Direct3D suffered from slightly more overhead. The company also attributed its strong relationship with drivers and standards authors who have also helped optimize L4D2 on Linux.
"This experience lead to the question: why does an OpenGL version of our game run faster than Direct3D on Windows 7? It appears that it's not related to multitasking overhead. We have been doing some fairly close analysis and it comes down to a few additional microseconds overhead per batch in Direct3D which does not affect OpenGL on Windows. Now that we know the hardware is capable of more performance, we will go back and figure out how to mitigate this effect under Direct3D."
"The third category is especially interesting because it involves working with hardware manufacturers to identify issues in their drivers and, as a result, improving the public driver which benefits all games. Identifying driver stalls and adding multithreading support in the driver are two examples of changes that were the result of this teamwork."
With the above in mind, I do believe there are some items to consider, particularly ones that Valve's blog post doesn't seem to flesh out.
Presumably, only the latest (and proprietary) drivers would be used as the basis for both Windows and Linux tests, but we don't explicitly know this. Additionally, L4D2 runs on DX9 under Windows – a graphics API which pre-dates 2003. Unfortunately, the blog post also fails to mention what OpenGL version L4D2 is utilizing. It seems natural, for example, that newer OpenGL implementations may actually have an inherent performance advantage. OpenGL, afterall, strives to maintain backwards compatibility with previous releases (and older hardware), making it very possible that L4D2 is using a far more recent implementation.
There is also no talk regarding visual fidelity. Even small differences in visual quality can produce 20 percent performance gains, as both Nvidia and ATI have shown us in the past by "cheating" on benchmark tests.
Despite some healthy skepticism, it is great to see Valve making progress on the Linux platform and good to see it is learning from the experience as the project moves along. I, for one, am looking forward to Steam on Linux, although others may not be quite as enthusiastic.