[cfe-commits] cfe-commits Digest, Vol 49, Issue 1

Douglas Gregor dgregor at apple.com
Fri Jul 1 17:07:28 PDT 2011


On Jul 1, 2011, at 3:45 PM, Argyrios Kyrtzidis wrote:

> On Jul 1, 2011, at 12:28 PM, Zach Wheeler wrote:
> 
>> Looking at DiagnosticIDs.cpp again, it seems that he probably didn't store straight StringRefs because they would not pack efficiently for the short strings he was anticipating. 
>> 
>> OK, I'm not following you. The compilation of /which file/ gets slowed down by constructor calls to /what object/, exactly?
> 
> DiagnosticIDs.cpp contains huge static arrays. Putting a StringRef into the struct there would make the struct non-POD and its constructor would have to be called, and since it is a global array all the constructor calls would occur in the global initializer function.
> That caused a huge slow down when compiling that file but, apart from that, we generally try to avoid the need for global initializer functions as much as possible.

... especially because global initializer functions affect our startup time.

	- Doug




More information about the cfe-commits mailing list