public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13351] New: 10x slower execution speed GCC 3.3 (compared with GCC 3.2)
@ 2003-12-08  7:28 cline at parashift dot com
  2003-12-08  7:43 ` [Bug c++/13351] [3.3 Regression] " pinskia at gcc dot gnu dot org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: cline at parashift dot com @ 2003-12-08  7:28 UTC (permalink / raw)
  To: gcc-bugs

The execution speed of the following simple program is 10x slower on GCC 3.3 
than on GCC 3.2 (using cygwin; I haven't tested Linux yet).  To reproduce, 
save it and compile with:
  g++ -Wall -pedantic -O -DNDEBUG speedtest2.cpp

========================================================================
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <sys/types.h>
#include <sys/timeb.h>

inline
double timeToMillisec()
{
  timeb x;    // Change to _timeb with MSVC++
  ftime(&x);  // Change to _ftime with MSVC++
  return double(x.time) + double(x.millitm)/1000.0;
}

typedef std::string           String;
typedef std::vector<String>   List;
typedef std::map<String,List> Map;

List foo(unsigned numEntries)
{
  List v;
  for (unsigned i = 0u; i < numEntries; ++i)
    v.push_back(String("foo") + char(i % 256));
  return v;
}

Map bar(unsigned numEntries, List v)
{
  Map m;
  for (unsigned i = 0u; i < numEntries; ++i)
    m[String("foo") + char(i % 256)] = v;
  return m;
}

int main()
{
  const unsigned perIteration = 1000u;

  std::cout << "Testing: " << std::flush;
  const double begin = timeToMillisec();
  double elapsed;
  unsigned total = 0u;

  do {
    bar(perIteration, foo(perIteration));
    total += perIteration * perIteration;
    elapsed = timeToMillisec() - begin;
  } while (elapsed < 1.0);

  std::cout << total << " in " << elapsed << " sec = "
            << (elapsed * 1000.0 * 1000.0 / total) << " ns/per\n";

  return 0;
}
========================================================================

-- 
           Summary: 10x slower execution speed GCC 3.3 (compared with GCC
                    3.2)
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: cline at parashift dot com
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13351


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2003-12-23  9:47 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-08  7:28 [Bug c++/13351] New: 10x slower execution speed GCC 3.3 (compared with GCC 3.2) cline at parashift dot com
2003-12-08  7:43 ` [Bug c++/13351] [3.3 Regression] " pinskia at gcc dot gnu dot org
2003-12-08 10:38 ` [Bug c++/13351] [3.3 Regression] 10x slower generated code (GCC 3.3 compared " cline at parashift dot com
2003-12-08 10:42 ` cline at parashift dot com
2003-12-08 11:16 ` [Bug libstdc++/13351] " pinskia at gcc dot gnu dot org
2003-12-08 12:10 ` [Bug libstdc++/13351] [3.3 Regression] Generated code is noticeable slower (compared to 3.2) giovannibajo at libero dot it
2003-12-08 13:00 ` cline at parashift dot com
2003-12-08 13:09 ` [Bug libstdc++/13351] [3.3 Regression] BIG slowdown in generated code " giovannibajo at libero dot it
2003-12-08 13:31 ` falk at debian dot org
2003-12-08 15:33 ` carlo at alinoe dot com
2003-12-08 17:38 ` gdr at integrable-solutions dot net
2003-12-09 21:30 ` bkoz at gcc dot gnu dot org
2003-12-13 22:02 ` cline at parashift dot com
2003-12-23 10:01 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).