[Issue 4721] New: compilation slow when compiling unittests on dcollections

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Aug 24 06:44:12 PDT 2010


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

           Summary: compilation slow when compiling unittests on
                    dcollections
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: schveiguy at yahoo.com


--- Comment #0 from Steven Schveighoffer <schveiguy at yahoo.com> 2010-08-24 06:44:06 PDT ---
When compiling dcollections unit tests, it takes over 1 minute to compile the
small library.  I am unsure what the exact trigger is to make it slow.  At the
request of Walter, I profiled the compiler to try and see where the slowdown
was.  Here are the first few lines of the results using gprof:

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
  1.28      6.97     0.11   663755     0.00     0.00  ScopeDsymbol::search(Loc,
Identifier*, int)
  1.05      7.06     0.09  2623497     0.00     0.00  isType(Object*)
  0.76      7.12     0.07   911667     0.00     0.00  match(Object*, Object*,
TemplateDeclaration*, Scope*)
  0.76      7.19     0.07   656268     0.00     0.00  _aaGetRvalue(AA*, void*)
  0.58      7.24     0.05  2507041     0.00     0.00  isTuple(Object*)

Walter said it looks like elf_findstr is a problem area and asked me to file
this bug.  The relevant discussion is here:
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=116007

All I can say to duplicate this is to download the latest svn of dcollections
and compile unit tests.  If you are running the profiled version, it takes a
long long time to complete (I gave up after 5 minutes).  I suggest compiling
just one class, HashMap.  The compile time for this takes 4 seconds.  The
appropriate commands to run are:

svn co http://svn.dsource.org/projects/dcollections/branches/d2 dcollections
cd dcollections
dmd -unittest dcollections/HashMap.d dcollections/Hash.d
dcollections/Iterators.d dcollections/model/*

The compilation will fail, because there is no main function, but it will
demonstrate the problem well enough.

If you want to compile the entire unit test suite, use the command:

./build-lib-linux.sh unittest

Which builds and runs the unit tests for the whole library.  This takes over a
minute to compile.

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