facebook/hhvm — pull request #3808 by denji (2014-09-21 20:11:38+00:00)
Title: Preprocessor constructs in g++ performance regressions

Complicated constructs may present stark differences in expansion times between 4.7.x and 4.8.x C++11 modes in `g++` as well as between `clang++` and `g++ 4.8.x`. In summary:

- Both `clang++` and earlier versions of `g++` prove far more performant to `g++ 4.8.x`, at times by several factors in **really** complex macro expansions.
- From gcc bugzilla entries http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56746 and http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53525 this is known to be a performance regression of the 4.8.x branch so far.
- Use of `g++ 4.8.x` with such constructs may result in out of memory errors, system lockup, memory fragmentation and other erratic behavior depending which worst - case scenario of said gcc preprocessor performance regression is met.
- The recommended fix for this kind of gcc performance regression is to pass during invocation of g++, the `-ftrack-macro-expansion=0` flag in order to bypass macro tracking which heavily contributes to this behavior.

Therefore, if g++ is detected as the compiler used during configuration with autotools, this flag should be passed *implicitly *in order to deal with such a `g++` performance regression.