[LLVMbugs] [Bug 12553] New: constexpr and template metaprogram compiles extremely slowly compared to gcc

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Apr 13 18:26:11 PDT 2012


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

             Bug #: 12553
           Summary: constexpr and template metaprogram compiles extremely
                    slowly compared to gcc
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: public at alisdairm.net
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 8387
  --> http://llvm.org/bugs/attachment.cgi?id=8387
metaprogramming torture test to compute prime numbers

The attached program is one of my recreational C++11 programs, it tries to
compute a large array of prime numbers entirely at compile time, and has been
optimized to produce the largest number possible in the shortest compile-time,
minimizing compiler resources.

As currently configured, it compiles on gcc 4.7 in approximately one second,
but with my current version of Clang in just over 4 minutes.  Configuration is
essentially one constant towards the end of the file that determines the
maximum range of numbers to search.  The limiting factor with GCC is to avoid
swap-file thrashing, which allows for growing by a factor of another 6 powers
of 2.

The Clang version is clearly CPU bound, using only around 50Mb RAM in the
attached configuration and not coming close to swapping to page file.

Clang configuration:
   clang version 3.1 (trunk 153754)
   Target: x86_64-apple-darwin11.3.0
   Thread model: posix

Running on OSX Lion.

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