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

Zach Wheeler zachw.foss at gmail.com
Sat Jul 2 09:17:36 PDT 2011


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110702/3595d6c1/attachment.html>


More information about the cfe-commits mailing list