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

Matthieu Monrocq matthieu.monrocq at gmail.com
Sun Jul 3 03:21:51 PDT 2011

2011/7/2 Zach Wheeler <zachw.foss at gmail.com>

> On Fri, Jul 1, 2011 at 8:07 PM, Douglas Gregor <dgregor at apple.com> wrote:
>> 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
> Thanks for clarifying Argyrios and Doug; I think I understand
> DiagnosticIDs.cpp better now.
> Perhaps I'm being dense, but still I don't understand why the methods in
> Option.cpp have to call strlen so many times; it seems like there's a few
> ways around that. Did I misunderstand something?
> ZJ

As far as I can tell, they certainly don't have to. The very presence of
FIXME seems to indicate that a StringRef-ication would be welcome.

-- Matthieu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110703/1b15e7fb/attachment.html>

More information about the cfe-commits mailing list