FreeBSD 6.2-RELEASE FreeBSD 6.2-RELEASE #0: Mon Jan 15 14:39:55 MSK 2007 [EMAIL PROTECTED]:/usr/src/sys/i386/compile/MY i386

test prog - test_set.cpp:
#include <set>
#include <stdlib.h>
#include <stdio.h>
#include <sys/time.h>

timeval bgn, end;

int main()
{
  std::set<long> s;
  printf("filling\n");
gettimeofday(&bgn, NULL);
  for (int i = 0; i < (1<<20); i++)
  {
      s.insert((rand() << 16) + rand());
  }
gettimeofday(&end, NULL);
float t1 = float (end.tv_sec - bgn.tv_sec) + float (end.tv_usec - bgn.tv_usec) / 1000000.0f;

  printf("clearing\n");
gettimeofday(&bgn, NULL);
  s.clear();
gettimeofday(&end, NULL);

float t2 = float (end.tv_sec - bgn.tv_sec) + float (end.tv_usec - bgn.tv_usec) / 1000000.0f;
  printf("done\n");
printf("alloc time %.3f\tclear time %.3f\n", t1, t2);


  for (int i = 0; i < (1<<20); i++)
  {
      s.insert((rand() << 16) + rand());
  }

}



valiy# g++ -v
Using built-in specs.
Configured with: FreeBSD/i386 system compiler
Thread model: posix
gcc version 3.4.4 [FreeBSD] 20050518

valiy# g++34 -v
Reading specs from /usr/local/lib/gcc/i386-portbld-freebsd6.2/3.4.6/gcc/i386-portbld-freebsd6.2/3.4.6/specs Configured with: ./..//gcc-3.4.6/configure --disable-nls --with-system-zlib --with-libiconv-prefix=/usr/local --program-suffix=34 --libdir=/usr/local/lib/gcc/i386-portbld-freebsd6.2/3.4.6 --with-gxx-include-dir=/usr/local/lib/gcc/i386-portbld-freebsd6.2/3.4.6/include/c++/ --infodir=/usr/local/info/gcc34 --prefix=/usr/local i386-portbld-freebsd6.2
Thread model: posix
gcc version 3.4.6 [FreeBSD]

valiy# g++42 -v
Using built-in specs.
Target: i386-portbld-freebsd6.2
Configured with: ./..//gcc-4.2-20070307/configure --disable-nls --with-system-zlib --with-libiconv-prefix=/usr/local --with-gmp=/usr/local --program-suffix=42 --libdir=/usr/local/lib/gcc-4.2.0 --with-gxx-include-dir=/usr/local/lib/gcc-4.2.0/include/c++/ --infodir=/usr/local/info/gcc42 --disable-rpath --prefix=/usr/local i386-portbld-freebsd6.2
Thread model: posix
gcc version 4.2.0 20070307 (prerelease)


valiy# g++295 -v
Reading specs from /usr/local/lib/gcc-lib/i386-portbld-freebsd6.2/2.95.3/specs
gcc version 2.95.3 20010315 (release)


valiy# g++ test_set.cpp
valiy# ./a.out
filling
clearing
done
alloc time 3.783        clear time 7.987

valiy# g++34 test_set.cpp
valiy# ./a.out
filling
clearing
done
alloc time 3.850        clear time 7.889

valiy# ./a.out
filling
clearing
done
alloc time 4.253        clear time 7.994

valiy# ./a.out
filling
clearing
done
alloc time 3.573        clear time 0.293

how to fix?

Reply via email to