[Bug libstdc++/46659] New: std::list iterator debugging (_GLIBCXX_DEBUG) is much slower than stlport's one.

pluto at agmk dot net gcc-bugzilla@gcc.gnu.org
Thu Nov 25 15:34:00 GMT 2010


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

           Summary: std::list iterator debugging (_GLIBCXX_DEBUG) is much
                    slower than stlport's one.
           Product: gcc
           Version: 4.5.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: pluto@agmk.net


Created attachment 22532
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22532
testcase with preprocessed sources.

an evil testcase:

#include <list>
#include <vector>
int main()
{
        typedef std::list< int > L;
        L list;
        typedef std::vector< L::const_iterator > V;
        V vec;
        for ( int i = 0; i < 30000; i++ )
                list.push_back( 42 );
        for ( L::const_iterator j = list.begin(); j != list.end(); ++j )
                vec.push_back( j );
        list.clear();
}

compilation with libstdc++ and stlport-5.2.1 for benchmarking:

/local/devel/toolchain45/x86_64-gnu-linux.mt_alloc/bin/x86_64-gnu-linux-g++
-pthread -O2 -Wall -D_GLIBCXX_DEBUG --save-temps \
        t.cpp -o t-libstdcxx
mv t.ii t-libstdcxx.ii

/local/devel/toolchain45/x86_64-gnu-linux.mt_alloc/bin/x86_64-gnu-linux-g++
-pthread -O2 -Wall -D_STLP_DEBUG=1 -isystem ./STLport-5.2.1/include/stlport
--save-temps \
        t.cpp -o t-stlport ./STLport-5.2.1/lib64/libstlportstlg.a
mv t.ii t-stlport.ii


and few benchmarks on athlon64-2800+:

20000 elements:

$ time ./t-libstdcxx
./t-libstdcxx  8,28s user 0,00s system 97% cpu 8,458 total
$ time ./t-stlport  
./t-stlport  4,57s user 0,01s system 98% cpu 4,644 total

30000 elements:

$ time ./t-libstdcxx
./t-libstdcxx  19,03s user 0,01s system 97% cpu 19,433 total
$ time ./t-stlport
./t-stlport  8,93s user 0,00s system 98% cpu 9,095 tota



More information about the Gcc-bugs mailing list