Bug#102193: gcc-3.0: compiled code with gcc 3.0 is slow and big
Package: gcc-3.0
Version: 1:3.0.3-1
I don't know if it's valid for this bug report, but all code I have tried is
slower in g++ 3, here's a simple example:
(numbers first, code in the bottom)
mbp:~$ g++ benchmark.cpp ; ls -l a.out ; time a.out ; g++-3.0 benchmark.cpp
; ls -l a.out ; time a.out
-rwxr-xr-x 1 mbp mbp 42840 5 jan 02:14 a.out*
real 0m13.542s
user 0m6.200s
sys 0m0.220s
-rwxr-xr-x 1 mbp mbp 38016 5 jan 02:14 a.out*
real 0m20.882s
user 0m9.950s
sys 0m0.080s
The first one is g++ 2.95.4 and the second is g++ 3.0.3.
This is the code:
#include <string>
#include <vector>
#include <algorithm>
using std::string;
using std::vector;
int main()
{
string test = "IUHASISAHDNI";
vector<string> vec;
for (int i = 0; i <= 500000; ++i) {
string newstr;
test += "NAWNASDKJNKNN";
newstr = test;
string::size_type pos = newstr.find("NAW");
test = newstr.substr(pos, 3);
newstr = test;
newstr.append("HASDASNDJKANKDJNASDJAKNDKJASNDKSAND");
vec.push_back(newstr);
vec.push_back(test);
}
vector<string> newvec;
std::copy(vec.begin(), vec.end(), back_inserter(newvec));
}
-- System Information
Debian Release: 3.0
Architecture: i386
Kernel: Linux kolon 2.4.17 #1 man dec 24 13:52:51 CET 2001 i686
Locale: LANG=da_DK, LC_CTYPE=da_DK
Versions of packages gcc-3.0 depends on:
ii binutils 2.11.92.0.12.3-4 The GNU assembler, linker and bina
ii cpp-3.0 1:3.0.3-1 The GNU C preprocessor.
ii gcc-3.0-base 1:3.0.3-1 The GNU Compiler Collection (base
ii libc6 2.2.4-7 GNU C Library: Shared libraries an
ii libgcc1 1:3.0.3-1 GCC support library.
Reply to: