News for hackers. Stuff that matters.
Re:Clang vs GCC benchmark on UnrealEngine3 by mschuster91 on Tuesday April 22, 2014 @06:14AM (#7626750)
Seriously, a 70MB binary?

Is this all program code or does this include resources?

Re:Clang vs GCC benchmark on UnrealEngine3 by Cthulhu_ on Tuesday April 22, 2014 @06:44AM (#7626841)
Well, judging by the title, it's the Unreal 3 engine; I'd say that would end up being a pretty big binary.
Re:Clang vs GCC benchmark on UnrealEngine3 by mschuster91 on Tuesday April 22, 2014 @07:00AM (#7626891)
The problem is performance: a small binary might end up having lots of its code in L1 (16KByte) / L2 (512 KByte) cache (dec2013 values for i7, taken from https://www.scss.tcd.ie/Jeremy.Jones/CS3021/5%20caches.pdf)... but a 70mb binary should produce a lot of cache misses.

I wonder what performance penalties arise from that.

Re:Clang vs GCC benchmark on UnrealEngine3 by w0utert on Tuesday April 22, 2014 @07:17AM (#7626946)
I assume the 70MB binary statically links in all kinds of assets that blow up the file size, static arrays of pre-calculated data etc. There's no way it compiles to 70MB of assembly.

The code size would still be massively bigger than the CPU code cache, but the working set that actually matters for performance does not have to have any relation to the size of the total code itself, as long as time-critical sections are small and localized.

Re:Clang vs GCC benchmark on UnrealEngine3 by sharpneli on Tuesday April 22, 2014 @07:32AM (#7627002)
Considering the massive size increase due to debug symbols I'd guess that a sizable part of the 70MB indeed is assembly, at least 20MB and probably even more.

C++ templates, while being absolutely lovely to write and use, tend to do that. Every single different type you instantiate the template into produces a separate compiled copy of the whole template. Write a sorting function and use it for 5 types -> you get the same sort in assembler 5 times with differences that relate to the types they use, alongside with 5 massive symbol names (C++ template symbols tend to be really large).

Re:Clang vs GCC benchmark on UnrealEngine3 by exDM69 on Tuesday April 22, 2014 @08:19AM (#7627170)
> Write a sorting function and use it for 5 types -> you get the same sort in assembler 5 times with differences that relate to the types they use, alongside with 5 massive symbol names (C++ template symbols tend to be really large).

To be fair, this is also why the performance of C++ std::sort beats C qsort hands down. Calling the comparator function with a function pointer is expensive compared to doing an integer comparison. Additionally, the boundary between translation units (ie. object files) inhibits a lot of optimization that could otherwise take place (and does in the C++ case, when the function calls are inlined).

There are also techniques to avoid C++ template bloat, such as type erasure. Although this makes the template code only a thin shim that provides type safety.

Re:Clang vs GCC benchmark on UnrealEngine3 by sanxiyn on Tuesday April 22, 2014 @09:18AM (#7627433)
If functions really are same in assembly (e.g. type sizes are same) LLVM's mergefunc pass actually can merge them, leaving only a single copy.

http://llvm.org/docs/Passes.html

Re:Clang vs GCC benchmark on UnrealEngine3 by Negitivefrags on Tuesday April 22, 2014 @08:39AM (#7627254)
GCC seems to produce fairly fat binaries. Compared to what I'm used to seeing with MSVC at least.

The code for our linux game server compiles to an 11MB stripped binary with 608 megs of debug data.

The code for the windows game client contains the majority of that same code, but in addition also contains the entire renderer, UI, and a pile of other client side garbage and comes in at only 7MB with 86MB of debug data.

The 70MB for UE which would presumably be a much larger code base seems reasonable to me in that context.