Why C++ compiles slowly

Steven Schveighoffer schveiguy at yahoo.com
Thu Aug 26 04:37:20 PDT 2010


On Thu, 26 Aug 2010 02:13:34 -0400, Walter Bright  
<newshound2 at digitalmars.com> wrote:

> Steven Schveighoffer wrote:
>> On Tue, 24 Aug 2010 03:58:57 -0400, Walter Bright  
>> <newshound2 at digitalmars.com> wrote:
>>
>>> Steven Schveighoffer wrote:
>>>> With profiling enabled, gprof outputs this as the top hitters:
>>>>   Flat profile:
>>>>  Each sample counts as 0.01 seconds.
>>>>   %   cumulative   self              self     total
>>>>  time   seconds   seconds    calls  ms/call  ms/call  name
>>>>  77.76      6.68     6.68     2952     2.26     2.26   
>>>> elf_findstr(Outbuffer*, char const*, char const*)
>>>>   2.10      6.86     0.18     4342     0.04     0.04  searchfixlist
>>>
>>> elf_findstr definitely looks like a problem area. I can't look at it  
>>> right now, so can you post this to bugzilla please?
>>  http://d.puremagic.com/issues/show_bug.cgi?id=4721
>
> Let me know how this works:
>
> http://www.dsource.org/projects/dmd/changeset/628

Better, now takes 20 seconds vs over 60.  The new culprit:

Flat profile:

Each sample counts as 0.01 seconds.
   %   cumulative   self              self     total
  time   seconds   seconds    calls  ms/call  ms/call  name
  75.79      6.51     6.51     8103     0.80     0.80   
TemplateDeclaration::toJsonBuffer(OutBuffer*)
   3.14      6.78     0.27  1668093     0.00     0.00   
StructDeclaration::semantic(Scope*)
   2.10      6.96     0.18        1   180.00   180.00  do32bit(FL, evc*,  
int)
   1.98      7.13     0.17    15445     0.01     0.01   
EnumDeclaration::toJsonBuffer(OutBuffer*)
   0.70      7.19     0.06   656268     0.00     0.00   
Port::isSignallingNan(long double)
   0.47      7.23     0.04   915560     0.00     0.00   
StructDeclaration::toCBuffer(OutBuffer*, HdrGenState*)
   0.47      7.27     0.04                              
Dsymbol::searchX(Loc, Scope*, Identifier*)

I haven't looked at toJsonBuffer at all (btw, why are we calling this  
function if I'm not outputting json?)

-Steve


More information about the Digitalmars-d mailing list