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

Zach Wheeler zachw.foss at gmail.com
Mon Jul 4 10:50:28 PDT 2011


On Sun, Jul 3, 2011 at 6:21 AM, Matthieu Monrocq <matthieu.monrocq at gmail.com
> wrote:

>
>
> 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
>

I did misunderstand you; I thought you were talking about Option.cpp in your
first email. Sorry about that. All clear now. :-)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110704/4c89c4ac/attachment.html>


More information about the cfe-commits mailing list