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



--- Comment #2 from Markus Trippelsdorf <markus at trippelsdorf dot de> 
2013-03-16 10:30:51 UTC ---

Looks like the sorting of a std::list container is mostly responsible:

  168     list<element_t> container(first, last);

  169     container.sort();



When I run just with size 10 I get:



markus@x4 ~ % c++ -O2 -fsanitize=address bench.cpp

markus@x4 ~ % time ./mem ./a.out

size            array   vector with pointers    vector with iterators   deque  

10              0.47            0.48            0.54                    1.06

list            set             multiset

13.69(!)        2.41            3.97

./mem ./a.out  21.80s user 0.99s system 99% cpu 22.791 total

peak=2736348  



Without the list test I get a reasonable result:

(238 //    run(list_test, buffer, buffer_end, n);)



markus@x4 ~ % time ./mem ./a.out

size            array   vector with pointers    vector with iterators

10              0.46            0.47            0.5

deque           set             multiset

1.03            1.93            3.71

./mem ./a.out  7.67s user 0.56s system 99% cpu 8.245 total

markus@x4 ~ % memusg: peak=1415416



For comparison clang:

markus@x4 ~ % clang++ -O2 -fsanitize=address bench.cpp

markus@x4 ~ % time ./mem ./a.out

size            array   vector with pointers    vector with iterators  deque

10              0.42            0.41            0.42                   0.96

list           set             multiset

5.73            2.93            5.69

./mem ./a.out  16.52s user 0.10s system 99% cpu 16.627 total

markus@x4 ~ % memusg: peak=229660

Reply via email to