[Issue 4721] compilation slow when compiling unittests on dcollections

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Aug 26 11:42:12 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4721



--- Comment #9 from Steven Schveighoffer <schveiguy at yahoo.com> 2010-08-26 11:42:02 PDT ---
(In reply to comment #8)
> 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*)

That table of functions is invalid -- I somehow compiled dmd wrong when running
that profile.  I think I used a unit test build.  However, that was only the
profiled version, the non-profiled version still takes 20 seconds to compile
dcollections.

In any case, here is the correctly profiled version's heavy hitters:

Each sample counts as 0.01 seconds.
  %   cumulative   self              self     total
 time   seconds   seconds    calls  ms/call  ms/call  name
 80.31     11.99    11.99    19000     0.63     0.63  searchfixlist
  0.67     12.09     0.10   203173     0.00     0.00  StringTable::search(char
const*, unsigned int)
  0.60     12.18     0.09   369389     0.00     0.00  Lexer::scan(Token*)
  0.54     12.26     0.08   953613     0.00     0.00  ScopeDsymbol::search(Loc,
Identifier*, int)
  0.47     12.33     0.07  1449798     0.00     0.00  calccodsize

Note, this profile is different from the first in that I was compiling the
*entire* dcollections library, not just HashMap (which is now bearable due to
the improved performance!).  This is why the # calls is much higher on this one
compared to the original.

So the last significant performance problem here is searchfixlist. Looking
back, it was 2% of the runtime before, now it's jumped to 80%.

Looking at the function in backend/cod3.c, it appears to be another linear
search through a linked list.  I understand much less about this function than
the other, so I'm not sure how/if it should be solved.  Perhaps another hash
map?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list