[LLVMbugs] [Bug 6998] New: clang poor template instantiation performance

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Apr 30 16:29:37 PDT 2010


http://llvm.org/bugs/show_bug.cgi?id=6998

           Summary: clang poor template instantiation performance
           Product: clang
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: alp at nuanti.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


Taken from my notes in PR6958:

Here's a quick comparative test putting g++ against clang on the template
instantiation test found in the paper "Effects of Metaprogramming Style on
Compilation Time"
(http://users.rcn.com/abrahams/instantiation_speed/index.html). 

This is a TOT release build, no debug symbols, codegen enabled.

By N=1000, gcc is ~10 times faster, and the growth ratio doesn't look too
healthy. Good news is, resource use seems constant and more stable than gcc,
and some simple profiling suggests the problem is localised to Sema, with
CodeGen/IRGen doing fine, and the parser performing very well.

Given the heavy templating in the previously attached Comet test case, this
could be a good starting point to investigate. The paper is worth reading and
I'd be interested to hear about other profiling work going on and the tools
being used.

http://nuanti.com/tmp/clang-tmpl-2010-04-29.png

                          Template instantiation timings
  CPU time (seconds)
    30 ++------------------------------------------------------------------+B
       |    gcc 4.4.3 **A***                                              ##|
       |clang r102560 ##B###                                            #B  |
    25 ++                                                             ##   ++
       |                                                            #B      |
       |                                                         #B#        |
    20 ++                                                      ##          ++
       |                                                     #B             |
       |                                                 ##B#               |
    15 ++                                              B#                  ++
       |                                             ##                     |
       |                                          ##B                       |
    10 ++                                      #B#                         ++
       |                                ##B##B#                             |
       |                             #B#                                    |
     5 ++                        ##B#                                      ++
       |                  ##B##B#                                      **A**A
       +      + #B###B##B#  +      +    **A**A**A***A**A***A**A***A**A*     +
     0 ++-A***A**A***A**A***A**A***A**A*--+-----+------+------+------+-----++
       0     100    200    300    400    500   600    700    800    900    1000
                                    -DREPEATS=n

# N g++ clang++
50 0.14 0.26
100 0.19 0.51
150 0.25 0.93
200 0.32 1.47
250 0.40 2.14
300 0.50 2.95
350 0.60 3.91
400 0.72 4.98
450 0.83 6.22
500 0.97 7.56
550 1.10 9.08
600 1.26 10.68
650 1.42 12.44
700 1.58 14.48
750 1.78 16.66
800 1.96 18.61
850 2.16 20.93
900 2.46 23.39
950 2.69 26.22
1000 3.03 29.87

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list