public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: valiy <valiy-td@mail.ru>
To: gcc-bugs@gcc.gnu.org
Subject: Freebsd with g++3.* g++4.* set.clear() very slow
Date: Sat, 05 May 2007 16:07:00 -0000	[thread overview]
Message-ID: <463CAAD8.4050307@mail.ru> (raw)

FreeBSD  6.2-RELEASE FreeBSD 6.2-RELEASE #0: Mon Jan 15 14:39:55 MSK 
2007     root@valiy.corp.mail.ru:/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	other threads:[~2007-05-05 16:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=463CAAD8.4050307@mail.ru \
    --to=valiy-td@mail.ru \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).