[Issue 8487] New: Semantic analysis of templates is insanely slow
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jul 31 19:58:16 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8487
Summary: Semantic analysis of templates is insanely slow
Product: D
Version: unspecified
Platform: All
OS/Version: All
Status: NEW
Severity: major
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: jmdavisProg at gmx.com
--- Comment #0 from Jonathan M Davis <jmdavisProg at gmx.com> 2012-07-31 19:57:58 PDT ---
Created an attachment (id=1129)
Module with named entities which takes 6+ minutes to compile
The attached program is a slightly altered version of what I currenly have in
the D lexer that I'm putting together. It uses some TypeTuples, a template, and
some mixins to fill an AA with all of the named HTML entities and their values.
It has a second template and associated mixins to test that the names and
values match dmd. It takes over _6 minutes_ to build on my Phenom II. This is
_insanely_ slow and is a serious impediment for the lexer that I'm working on.
Based on the results of using googleperftools on the compiler, it appears that
the vast majority of the time is spent on the semantic analysis of templates.
I'll attach the full results shortly, but this is the top
10042 30.4% 30.4% 32889 99.6% TemplateInstance::semantic
8391 25.4% 55.8% 22394 67.8% arrayObjectMatch
8240 25.0% 80.8% 14045 42.5% match
3153 9.6% 90.4% 3153 9.6% StringExp::compare
1656 5.0% 95.4% 5075 15.4% StringExp::equals
654 2.0% 97.3% 654 2.0% Expression::dyncast
247 0.7% 98.1% 247 0.7% __GI_memcmp
76 0.2% 98.3% 81 0.2% _int_malloc
63 0.2% 98.5% 63 0.2% __GI_memcpy
52 0.2% 98.7% 52 0.2% Tuple::dyncast
35 0.1% 98.8% 107 0.3% __libc_malloc
31 0.1% 98.9% 31 0.1% touchfunc
25 0.1% 99.0% 56 0.2% ecom
12 0.0% 99.0% 80 0.2% VarDeclaration::syntaxCopy
10 0.0% 99.0% 15 0.0% _IO_vfprintf
To quote the googleperftools' docs (
http://google-perftools.googlecode.com/svn/trunk/doc/cpuprofile.html ):
------------
Text mode has lines of output that look like this:
14 2.1% 17.2% 58 8.7% std::_Rb_tree::find
Here is how to interpret the columns:
1. Number of profiling samples in this function
2. Percentage of profiling samples in this function
3. Percentage of profiling samples in the functions printed so far
4. Number of profiling samples in this function and its callees
5. Percentage of profiling samples in this function and its callees
6. Function name
------------
which should explain the format of the above results.
--
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