performance testresults

Stefan Olsson stefan@xapa.se
Wed Feb 4 09:42:00 GMT 2004


Hi,

this looks a bit strange to me since it doesn't match my testresults 
(outside of the libstdc++ testsuite). I know, I should find the answer 
to this myself but I have not access to the machine where I have the 
required tools (tcl etc) right now...
...are the single threaded tests compiled with -pthread or not? When 
compiled with -pthread on a single threaded application mt allocator is 
about 10-20% slower than raw malloc in this kind of test.

Also, if one modifies the test to call do_loop(obj); twice the results 
are quite different...
...at least on Linux where I have done the tests/development. This is 
due to the fact that the second time, free memory is "found" much faster 
by mt allocator than by malloc.

Brgds

/Stefan

Benjamin Kosnik wrote:

>So, just for fun, here are the results for today's libstdc++.
>
>Now that there are results for map and set, it looks pretty bleak!
>
>-benjamin
>
>  
>
>------------------------------------------------------------------------
>
>allocator.cc             	iterations: 100000	type: __gnu_norm::vector<int, __gnu_cxx::malloc_allocator<int> >	
>allocator.cc             	                         	  55r   29u   26s        0mem   11pf 
>allocator.cc             	iterations: 100000	type: __gnu_norm::vector<int, __gnu_cxx::new_allocator<int> >	
>allocator.cc             	                         	  54r   35u   19s        0mem   15pf 
>allocator.cc             	iterations: 100000	type: __gnu_norm::vector<int, __gnu_cxx::__mt_alloc<int> >	
>allocator.cc             	                         	  56r   34u   22s    25216mem   17pf 
>allocator.cc             	iterations: 100000	type: __gnu_norm::list<int, __gnu_cxx::malloc_allocator<int> >	
>allocator.cc             	                         	 256r  216u   40s 204800000mem   10pf 
>allocator.cc             	iterations: 100000	type: __gnu_norm::list<int, __gnu_cxx::new_allocator<int> >	
>allocator.cc             	                         	 274r  229u   45s 204800000mem   12pf 
>allocator.cc             	iterations: 100000	type: __gnu_norm::list<int, __gnu_cxx::__mt_alloc<int> >	
>allocator.cc             	                         	 153r   86u   64s 307806648mem   13pf 
>allocator.cc             	iterations: 100000	type: __gnu_norm::deque<int, __gnu_cxx::malloc_allocator<int> >	
>allocator.cc             	                         	  52r   35u   17s 51999960mem    3pf 
>allocator.cc             	iterations: 100000	type: __gnu_norm::deque<int, __gnu_cxx::new_allocator<int> >	
>allocator.cc             	                         	  58r   47u   11s 51999960mem    5pf 
>allocator.cc             	iterations: 100000	type: __gnu_norm::deque<int, __gnu_cxx::__mt_alloc<int> >	
>allocator.cc             	                         	  94r   85u    9s 52004088mem    5pf 
>allocator.cc             	iterations: 100000	type: __gnu_norm::map<int, int, std::less<int>, __gnu_cxx::malloc_allocator<int> >	
>allocator.cc             	                         	 943r  359u   88s 409600000mem   10pf 
>allocator.cc             	iterations: 100000	type: __gnu_norm::map<int, int, std::less<int>, __gnu_cxx::new_allocator<int> >	
>allocator.cc             	                         	 453r  358u   94s 409600000mem   12pf 
>allocator.cc             	iterations: 100000	type: __gnu_norm::map<int, int, std::less<int>, __gnu_cxx::__mt_alloc<int> >	
>allocator.cc             	                         	1511r  249u  132s 513007896mem   14pf 
>allocator.cc             	iterations: 100000	type: __gnu_norm::set<int, std::less<int>, __gnu_cxx::malloc_allocator<int> >	
>allocator.cc             	                         	 398r  343u   55s 307200000mem   10pf 
>allocator.cc             	iterations: 100000	type: __gnu_norm::set<int, std::less<int>, __gnu_cxx::new_allocator<int> >	
>allocator.cc             	                         	 420r  358u   62s 307200000mem   12pf 
>allocator.cc             	iterations: 100000	type: __gnu_norm::set<int, std::less<int>, __gnu_cxx::__mt_alloc<int> >	
>allocator.cc             	                         	 698r  252u   96s 513007896mem   14pf 
>allocator.cc-thread      	iterations: 100000	type: __gnu_norm::vector<int, __gnu_cxx::malloc_allocator<int> >	
>allocator.cc-thread      	                         	  56r   29u   27s        0mem    8pf 
>allocator.cc-thread      	iterations: 100000	type: __gnu_norm::vector<int, __gnu_cxx::new_allocator<int> >	
>allocator.cc-thread      	                         	  55r   35u   20s        0mem   12pf 
>allocator.cc-thread      	iterations: 100000	type: __gnu_norm::vector<int, __gnu_cxx::__mt_alloc<int> >	
>allocator.cc-thread      	                         	  56r   33u   23s   582536mem   18pf 
>allocator.cc-thread      	iterations: 100000	type: __gnu_norm::list<int, __gnu_cxx::malloc_allocator<int> >	
>allocator.cc-thread      	                         	 248r  211u   37s 204800000mem    7pf 
>allocator.cc-thread      	iterations: 100000	type: __gnu_norm::list<int, __gnu_cxx::new_allocator<int> >	
>allocator.cc-thread      	                         	 280r  225u   54s 204800000mem    9pf 
>allocator.cc-thread      	iterations: 100000	type: __gnu_norm::list<int, __gnu_cxx::__mt_alloc<int> >	
>allocator.cc-thread      	                         	 206r  131u   75s 308363968mem   14pf 
>allocator.cc-thread      	iterations: 100000	type: __gnu_norm::deque<int, __gnu_cxx::malloc_allocator<int> >	
>allocator.cc-thread      	                         	  52r   43u    9s 51999960mem    3pf 
>allocator.cc-thread      	iterations: 100000	type: __gnu_norm::deque<int, __gnu_cxx::new_allocator<int> >	
>allocator.cc-thread      	                         	  57r   49u    8s 51999960mem    5pf 
>allocator.cc-thread      	iterations: 100000	type: __gnu_norm::deque<int, __gnu_cxx::__mt_alloc<int> >	
>allocator.cc-thread      	                         	  94r   84u   10s 52004088mem    5pf 
>allocator.cc-thread      	iterations: 100000	type: __gnu_norm::map<int, int, std::less<int>, __gnu_cxx::malloc_allocator<int> >	
>allocator.cc-thread      	                         	 436r  352u   84s 409600000mem    7pf 
>allocator.cc-thread      	iterations: 100000	type: __gnu_norm::map<int, int, std::less<int>, __gnu_cxx::new_allocator<int> >	
>allocator.cc-thread      	                         	 449r  360u   89s 409600000mem    9pf 
>allocator.cc-thread      	iterations: 100000	type: __gnu_norm::map<int, int, std::less<int>, __gnu_cxx::__mt_alloc<int> >	
>allocator.cc-thread      	                         	 753r  310u  118s 513565216mem   15pf 
>allocator.cc-thread      	iterations: 100000	type: __gnu_norm::set<int, std::less<int>, __gnu_cxx::malloc_allocator<int> >	
>allocator.cc-thread      	                         	 374r  324u   50s 307200000mem    7pf 
>allocator.cc-thread      	iterations: 100000	type: __gnu_norm::set<int, std::less<int>, __gnu_cxx::new_allocator<int> >	
>allocator.cc-thread      	                         	 393r  331u   62s 307200000mem    9pf 
>allocator.cc-thread      	iterations: 100000	type: __gnu_norm::set<int, std::less<int>, __gnu_cxx::__mt_alloc<int> >	
>allocator.cc-thread      	                         	 823r  300u  115s 513565216mem   15pf 
>allocator_map_thread.cc-thread	iterations: 25000	type: __gnu_norm::map<int, int, std::less<int>, std::allocator<std::pair<int const, int> > >	
>allocator_map_thread.cc-thread	                         	  90r    0u    0s      144mem    9pf 
>allocator_map_thread.cc-thread	iterations: 25000	type: __gnu_norm::map<int, int, std::less<int const>, __gnu_cxx::new_allocator<int> >	
>allocator_map_thread.cc-thread	                         	  86r    0u    0s        0mem    9pf 
>allocator_map_thread.cc-thread	iterations: 25000	type: __gnu_norm::map<int, int, std::less<int const>, __gnu_cxx::malloc_allocator<int> >	
>allocator_map_thread.cc-thread	                         	  78r    0u    0s      216mem    9pf 
>allocator_map_thread.cc-thread	iterations: 25000	type: __gnu_norm::map<int, int, std::less<int const>, __gnu_cxx::__mt_alloc<std::pair<int const, int> > >	
>allocator_map_thread.cc-thread	                         	  52r    0u    0s  3988056mem    9pf 
>allocator_thread.cc-thread	iterations: 25000	type: __gnu_norm::vector<int, __gnu_cxx::malloc_allocator<int> >	
>allocator_thread.cc-thread	                         	  79r    0u    0s      216mem   10pf 
>allocator_thread.cc-thread	iterations: 25000	type: __gnu_norm::vector<int, __gnu_cxx::new_allocator<int> >	
>allocator_thread.cc-thread	                         	  79r    0u    0s      216mem   10pf 
>allocator_thread.cc-thread	iterations: 25000	type: __gnu_norm::vector<int, __gnu_cxx::__mt_alloc<int> >	
>allocator_thread.cc-thread	                         	  84r    0u    0s   656336mem    9pf 
>allocator_thread.cc-thread	iterations: 25000	type: __gnu_norm::list<int, __gnu_cxx::malloc_allocator<int> >	
>allocator_thread.cc-thread	                         	1196r    0u    0s        0mem   10pf 
>allocator_thread.cc-thread	iterations: 25000	type: __gnu_norm::list<int, __gnu_cxx::new_allocator<int> >	
>allocator_thread.cc-thread	                         	1259r    0u    0s        0mem   10pf 
>allocator_thread.cc-thread	iterations: 25000	type: __gnu_norm::list<int, __gnu_cxx::__mt_alloc<int> >	
>allocator_thread.cc-thread	                         	 806r    0u    0s 160231416mem    9pf 
>allocator_thread.cc-thread	iterations: 25000	type: __gnu_norm::deque<int, __gnu_cxx::malloc_allocator<int> >	
>allocator_thread.cc-thread	                         	 135r    0u    0s       80mem    4pf 
>allocator_thread.cc-thread	iterations: 25000	type: __gnu_norm::deque<int, __gnu_cxx::new_allocator<int> >	
>allocator_thread.cc-thread	                         	 134r    0u    0s        0mem    4pf 
>allocator_thread.cc-thread	iterations: 25000	type: __gnu_norm::deque<int, __gnu_cxx::__mt_alloc<int> >	
>allocator_thread.cc-thread	                         	 132r    0u    0s    32920mem    3pf 
>allocator_thread.cc-thread	iterations: 25000	type: __gnu_norm::map<int, int, std::less<int>, __gnu_cxx::malloc_allocator<int> >	
>allocator_thread.cc-thread	                         	1718r    0u    0s       72mem   10pf 
>allocator_thread.cc-thread	iterations: 25000	type: __gnu_norm::map<int, int, std::less<int>, __gnu_cxx::new_allocator<int> >	
>allocator_thread.cc-thread	                         	1992r    0u    0s        0mem   10pf 
>allocator_thread.cc-thread	iterations: 25000	type: __gnu_norm::map<int, int, std::less<int>, __gnu_cxx::__mt_alloc<int> >	
>allocator_thread.cc-thread	                         	1429r    0u    0s 184326088mem    9pf 
>allocator_thread.cc-thread	iterations: 25000	type: __gnu_norm::set<int, std::less<int>, __gnu_cxx::malloc_allocator<int> >	
>allocator_thread.cc-thread	                         	1601r    0u    0s        0mem   10pf 
>allocator_thread.cc-thread	iterations: 25000	type: __gnu_norm::set<int, std::less<int>, __gnu_cxx::new_allocator<int> >	
>allocator_thread.cc-thread	                         	1882r    0u    0s        0mem   10pf 
>allocator_thread.cc-thread	iterations: 25000	type: __gnu_norm::set<int, std::less<int>, __gnu_cxx::__mt_alloc<int> >	
>allocator_thread.cc-thread	                         	1522r    0u    0s 156850640mem    9pf 
>string_append.cc         	char                     	   1r    1u    0s        0mem   13pf 
>string_append.cc         	string                   	   1r    1u    0s        0mem    0pf 
>string_append.cc         	char                     	   9r    8u    1s        0mem    0pf 
>string_append.cc         	string                   	  10r    9u    1s        0mem    0pf 
>string_append.cc         	char                     	  88r   84u    4s        0mem    0pf 
>string_append.cc         	string                   	 113r  109u    4s        0mem    0pf 
>string_cons_input_iterator.cc	                         	   1r    1u    0s        0mem    2pf 
>string_cons_input_iterator.cc	                         	  12r    9u    3s        0mem    0pf 
>string_cons_input_iterator.cc	                         	 119r   92u   27s        0mem    0pf 
>is_wchar_t.cc            	C                        	 118r  118u    0s        0mem    9pf 
>is_wchar_t.cc            	C++                      	 388r  388u    0s        0mem    0pf 
>narrow_widen_char.cc     	narrow                   	 309r  309u    0s        0mem    9pf 
>narrow_widen_char.cc     	narrow_array             	1127r 1125u    2s        0mem    0pf 
>narrow_widen_char.cc     	widen                    	 349r  349u    0s        0mem    0pf 
>narrow_widen_char.cc     	widen_array              	1131r 1129u    2s        0mem    0pf 
>narrow_widen_wchar_t.cc  	narrow                   	 320r  320u    0s        0mem    9pf 
>narrow_widen_wchar_t.cc  	narrow array             	 442r  441u    1s        0mem    0pf 
>narrow_widen_wchar_t.cc  	widen                    	 209r  209u    0s        0mem    0pf 
>narrow_widen_wchar_t.cc  	widen array              	 205r  203u    1s        0mem    0pf 
>wchar_t_in.cc            	C (iconv)                	 145r  145u    0s        0mem    3pf 
>wchar_t_in.cc            	C++ (codecvt)            	 206r  196u    0s        0mem    1pf 
>wchar_t_length.cc        	C++ (codecvt)            	 197r  192u    1s        0mem   10pf 
>wchar_t_out.cc           	C (iconv)                	 143r  143u    0s        0mem    4pf 
>wchar_t_out.cc           	C++ (codecvt)            	 234r  234u    0s        0mem    1pf 
>container_benchmark.cc   	size = 100 :                            	
>container_benchmark.cc   	array                    	  51r   51u    0s        0mem    0pf 
>container_benchmark.cc   	vector (pointer)         	  51r   51u    0s        0mem    0pf 
>container_benchmark.cc   	vector (iterator)        	  52r   52u    0s        0mem    0pf 
>container_benchmark.cc   	deque                    	 106r  106u    0s        0mem    1pf 
>container_benchmark.cc   	list                     	 304r  304u    0s        0mem    0pf 
>container_benchmark.cc   	set                      	 164r  164u    0s        0mem    1pf 
>container_benchmark.cc   	multiset                 	 277r  277u    0s        0mem    0pf 
>container_benchmark.cc   	size = 1000 :                           	
>container_benchmark.cc   	array                    	  74r   74u    0s        0mem    0pf 
>container_benchmark.cc   	vector (pointer)         	  75r   74u    1s        0mem    0pf 
>container_benchmark.cc   	vector (iterator)        	  76r   76u    0s        0mem    0pf 
>container_benchmark.cc   	deque                    	 107r  107u    0s        0mem    0pf 
>container_benchmark.cc   	list                     	 254r  254u    0s        0mem    0pf 
>container_benchmark.cc   	set                      	 155r  155u    0s        0mem    0pf 
>container_benchmark.cc   	multiset                 	 232r  232u    0s        0mem    0pf 
>container_benchmark.cc   	size = 10000 :                          	
>container_benchmark.cc   	array                    	  73r   71u    2s        0mem    0pf 
>container_benchmark.cc   	vector (pointer)         	  72r   71u    1s        0mem    0pf 
>container_benchmark.cc   	vector (iterator)        	  72r   71u    1s        0mem    0pf 
>container_benchmark.cc   	deque                    	  99r   99u    0s        0mem    0pf 
>container_benchmark.cc   	list                     	 274r  274u    0s        0mem    0pf 
>container_benchmark.cc   	set                      	 169r  169u    0s        0mem    0pf 
>container_benchmark.cc   	multiset                 	 329r  329u    0s        0mem    0pf 
>container_benchmark.cc   	size = 100000 :                         	
>container_benchmark.cc   	array                    	  70r   65u    5s        0mem    0pf 
>container_benchmark.cc   	vector (pointer)         	  69r   67u    2s        0mem    0pf 
>container_benchmark.cc   	vector (iterator)        	  71r   68u    3s        0mem    0pf 
>container_benchmark.cc   	deque                    	  98r   95u    3s        0mem    0pf 
>container_benchmark.cc   	list                     	 576r  575u    1s        0mem    0pf 
>container_benchmark.cc   	set                      	 439r  437u    2s        0mem    0pf 
>container_benchmark.cc   	multiset                 	 614r  614u    0s        0mem    0pf 
>list_create_fill_sort.cc 	Iters: 10000000  Size:    1	 179r  179u    0s        0mem   14pf 
>list_create_fill_sort.cc 	Iters:  1000000  Size:   10	 384r  383u    1s        0mem    0pf 
>list_create_fill_sort.cc 	Iters:   100000  Size:  100	 343r  343u    0s        0mem    0pf 
>list_create_fill_sort.cc 	Iters:    10000  Size: 1000	 383r  383u    0s        0mem    0pf 
>map_create_fill.cc       	                         	 124r  124u    0s        0mem    9pf 
>complex_norm.cc          	norm                     	 168r  166u    0s        0mem   11pf 
>complex_norm.cc          	                         	 118r  118u    0s        0mem    0pf 
>cout_insert_int.cc       	                         	 665r   19u   18s        0mem   21pf 
>filebuf_copy.cc          	C unlocked               	 673r  628u   45s        0mem    4pf 
>filebuf_copy.cc          	C++                      	 697r  666u   31s        0mem    0pf 
>filebuf_sputc.cc         	C                        	 512r  425u   38s        0mem    4pf 
>filebuf_sputc.cc         	C unlocked               	 368r  267u   41s        0mem    0pf 
>filebuf_sputc.cc         	C++                      	 331r  269u   39s        0mem    0pf 
>fstream_seek_write.cc    	                         	 254r   91u  163s        0mem    6pf 
>ifstream_extract_float.cc	precision 6              	2600r 2572u   14s        0mem    9pf 
>ifstream_extract_float.cc	precision 12             	2261r 2240u   10s        0mem    0pf 
>ifstream_extract_int.cc  	                         	 755r  741u   13s        0mem    5pf 
>ifstream_getline.cc      	                         	   2r    0u    0s        0mem    6pf 
>ofstream_insert_float.cc 	precision 6              	3628r 2820u   44s        0mem   20pf 
>ofstream_insert_float.cc 	precision 12             	3471r 2903u   43s        0mem    0pf 
>ofstream_insert_int.cc   	                         	1068r  536u   36s        0mem    9pf 
>  
>




More information about the Libstdc++ mailing list