[complement-svn] SF.net SVN: complement: [1329] trunk/explore/perf/STL
Status: Pre-Alpha
Brought to you by:
complement
From: <com...@us...> - 2006-10-16 21:05:28
|
Revision: 1329 http://svn.sourceforge.net/complement/?rev=1329&view=rev Author: complement Date: 2006-10-16 14:05:09 -0700 (Mon, 16 Oct 2006) Log Message: ----------- test with malloc in add-proxy added Modified Paths: -------------- trunk/explore/perf/STL/compare.tex trunk/explore/perf/STL/string/add-proxy/Makefile trunk/explore/perf/STL/string/test.sh trunk/explore/perf/STL/string-MT/add-proxy/Makefile trunk/explore/perf/STL/string-MT/test.sh trunk/explore/perf/STL/strings.gplot Added Paths: ----------- trunk/explore/perf/STL/string/add-proxy/STLport-malloc/ trunk/explore/perf/STL/string/add-proxy/STLport-malloc/Makefile trunk/explore/perf/STL/string-MT/add-proxy/STLport-malloc/ trunk/explore/perf/STL/string-MT/add-proxy/STLport-malloc/Makefile Property Changed: ---------------- trunk/explore/perf/STL/ Property changes on: trunk/explore/perf/STL ___________________________________________________________________ Name: svn:ignore - *.pcl compare.dvi compare.aux compare.toc compare.log compare.ps compare.pdf alloc.eps alloc.tex strings-MT-t-libstd.eps strings-MT-t-libstd.tex strings-MT-t-stlp-m.eps strings-MT-t-stlp-m.tex strings-MT-t-stlp-n.eps strings-MT-t-stlp-n.tex strings-MT-t-stlp-r.eps strings-MT-t-stlp-r.tex str-rope.eps str-rope.tex str-rope-1.eps str-rope-1.tex strings-MT.eps strings-MT.tex strings-MT2.eps strings-MT2.tex strings.eps strings.tex streams.eps streams.tex str-rope-2.eps str-rope-2.tex intel-amd.eps intel-amd.tex build + *.pcl compare.dvi compare.aux compare.toc compare.log compare.ps compare.pdf alloc.eps alloc.tex alloc-2_2_5.eps alloc-2_2_5.tex strings-MT-t-libstd.eps strings-MT-t-libstd.tex strings-MT-t-stlp-m.eps strings-MT-t-stlp-m.tex strings-MT-t-stlp-n.eps strings-MT-t-stlp-n.tex strings-MT-t-stlp-r.eps strings-MT-t-stlp-r.tex str-rope.eps str-rope.tex str-rope-1.eps str-rope-1.tex strings-MT.eps strings-MT.tex strings-MT2.eps strings-MT2.tex strings.eps strings.tex streams.eps streams.tex streams-1.eps streams-1.tex str-rope-2.eps str-rope-2.tex intel-amd.eps intel-amd.tex build Modified: trunk/explore/perf/STL/compare.tex =================================================================== --- trunk/explore/perf/STL/compare.tex 2006-10-16 20:16:12 UTC (rev 1328) +++ trunk/explore/perf/STL/compare.tex 2006-10-16 21:05:09 UTC (rev 1329) @@ -1,4 +1,4 @@ -% -*- LaTeX -*- Time-stamp: <06/10/16 19:00:51 ptr> +% -*- LaTeX -*- Time-stamp: <06/10/17 00:43:24 ptr> \documentclass[a4paper]{article} @@ -49,12 +49,13 @@ In the tests was used following computers and operational envirinments: \begin{enumerate} \item Tyan Tiger motherboard, two $1.33$-GHz - AMD$^{\mbox{\tiny\textregistered}}$ Athlon$^{\mbox{\tiny\textregistered}}$ XP 1500+ processors under Linux (kernel 2.6.16.26, \verb|glibc| 2{.}3{.}6);\label{AMD} + AMD$^{\mbox{\tiny\textregistered}}$ Athlon$^{\mbox{\tiny TM}}$ XP 1500+ processors under Linux (kernel 2{.}6{.}16{.}26, \verb|glibc| 2{.}3{.}6);\label{AMD} + \item Two $2.6$-GHz AMD$^{\mbox{\tiny\textregistered}}$ Opteron$^{\mbox{\tiny TM}}$ 252 processors under Linux (kernel 2{.}6{.}15, x86\_64, \verb|glibc| 2{.}3{.}6)\label{AMD64} \end{enumerate} \section{Compilers} -In tests was used GNU gcc 3{.}4{.}4 or 4{.}1{.}1 +In tests was used GNU gcc 3{.}4{.}4 (on AMD64) or 4{.}1{.}1 (on AMD) with appropriate \verb|libstdc++| libraries (version~3). @@ -137,7 +138,7 @@ \input strings.tex \end{center} \caption{STL strings implementations comparison. Single thread. $t$ is a wall time - for tests. + for tests. On X-axis you see test's number (see text). The implementation of strings in \STLport{} (non-COW) drammaticaly faster than COW implementations (\libstd{} and ropes in \STLport{}) in tests that modify strings. @@ -232,6 +233,10 @@ For \libstd{} both \#8 and \#9 are the same test. +The figure~\ref{STLport-gpp-strings} show that \STLport{} implementation +give better results even without expression templates. But with +expression templates the results are better more then twice. + \section{Role of Allocators} Note: in the \verb|glibc| 2{.}3{.}6 enhancement of memory allocation @@ -258,6 +263,14 @@ Wall time for tests. \label{STLport-alloc-strings}} \end{figure} +\begin{figure} + \begin{center} + \input alloc-2_2_5.tex + \end{center} + \caption{Role of memory allocator in strings implementation (\STLport), \texttt{glibc} 2{.}2{.}5. + Wall time for tests. \label{STLport-alloc-ii-ii-v-strings}} +\end{figure} + Let's repeat tests from section~\ref{TestsDescr} for \STLport{} with different allocators. We see (fig.~\ref{STLport-alloc-strings}) that all allocators are good enough @@ -266,10 +279,14 @@ %operations (test~1) the ``optimized'' \verb|node_alloc| has a tiny advantage %(difference between best and worst allocators is $3\%$). For search operations (test~2) the results as expected -are the same (within measure of inaccuracy). The tests 4 and 5 show +are the same (within measure of inaccuracy). + +The tests 4 and 5 show that cost of \verb|malloc| system call---\verb|node_alloc| reuse once allocated memory. But copy of string's content still present (compare with time of -\libstd{} on fig.~\ref{STLport-gpp-strings}). +\libstd{} on fig.~\ref{STLport-gpp-strings}). In the past (\verb|glibc| 2{.}2{.}5) +the cost of \verb|malloc| was significant, but now it near zero (compare graphics +\ref{STLport-alloc-strings} and \ref{STLport-alloc-ii-ii-v-strings}). \section{Strings in Multithreaded Environment} @@ -289,7 +306,7 @@ \input strings-MT.tex \end{center} \caption{Tests wall time (\libstd{} and \STLport{} - strings) in MT environment (two threads). + strings) in multi-threaded environment (two threads). \label{STLport-gpp-MT-strings}} \end{figure} @@ -298,7 +315,7 @@ \input strings-MT2.tex \end{center} \caption{Tests wall time (\libstd{} and \STLport{} - strings) in MT environment (two threads) (same as fig.~\ref{STLport-gpp-MT-strings}, another scale). + strings) in multi-threaded environment (two threads) (same as fig.~\ref{STLport-gpp-MT-strings}, another scale). \label{STLport-gpp-MT-strings2}} \end{figure} @@ -318,7 +335,7 @@ \end{center} \caption{ Wall time, user time and system time per thread for - \libstd{} in MT environment. + \libstd{} in multi-threaded environment. \label{gpp-MT-strings-t}} \end{figure} @@ -342,7 +359,7 @@ \end{center} \caption{ Wall time, user time and system time per thread for - \STLport{} (node allocator) in MT environment. + \STLport{} (node allocator) in multi-threaded environment. \label{STLport-MT-strings-t}} \end{figure} @@ -352,7 +369,7 @@ \end{center} \caption{ Wall time, user time and system time per thread for - \STLport{} (malloc allocator) in MT environment. + \STLport{} (malloc allocator) in multi-threaded environment. \label{STLport-MT-strings-m}} \end{figure} @@ -362,7 +379,7 @@ \end{center} \caption{ Wall time, user time and system time per thread for - \STLport{} ropes in MT environment. + \STLport{} ropes in multi-threaded environment. \label{STLport-MT-strings-r}} \end{figure} @@ -371,14 +388,14 @@ \texttt{node\_alloc}-based, figure~\ref{STLport-MT-strings-m} show profile for tests with \texttt{malloc}-based allocators, and figure~\ref{STLport-MT-strings-r} for ropes. -The surprise for me was that \texttt{malloc}-based variant +The surprise for me was that \texttt{malloc}-based variants win (in $1.5--2$ times faster) over \texttt{node\_alloc}-based variant in tests \#3, \#4 and \#5. This fact can be explained by usage of memory allocated chunks vector in \texttt{node\_alloc}. This vector accessed from different threads and such access should use thread synchronization primitives. Compare figures~\ref{STLport-alloc-strings} and \ref{STLport-gpp-MT-strings}. -The tests~1--2 has the same time in MT and non-MT context for +The tests~1--2 has the same time in multi-threaded and single-threaded context for \texttt{malloc}-based and \texttt{node\_alloc}-based allocators. In test~3 \texttt{malloc}-based variant climb down, while \texttt{node\_alloc}-based keep position. @@ -516,7 +533,7 @@ significant better than C \verb|fwrite|). With raw write to string stream (or in char buffer in case of C) the pure C variant is 3--4 times faster. -As about Intel$^{\mbox{\tiny\textregistered}}$ vs. AMD$^{\mbox{\tiny\textregistered}}$, no comments---see figure~\ref{intel-amd} on page~\pageref{intel-amd}. +% As about Intel$^{\mbox{\tiny\textregistered}}$ vs. AMD$^{\mbox{\tiny\textregistered}}$, no comments---see figure~\ref{intel-amd} on page~\pageref{intel-amd}. \section{References} Modified: trunk/explore/perf/STL/string/add-proxy/Makefile =================================================================== --- trunk/explore/perf/STL/string/add-proxy/Makefile 2006-10-16 20:16:12 UTC (rev 1328) +++ trunk/explore/perf/STL/string/add-proxy/Makefile 2006-10-16 21:05:09 UTC (rev 1329) @@ -1,6 +1,6 @@ # -*- Makefile -*- Time-stamp: <05/12/27 00:39:55 ptr> -DIRS = STLport-default STLport-add-str-proxy libstdc++ +DIRS = STLport-default STLport-malloc STLport-add-str-proxy libstdc++ all: for d in $(DIRS); do \ Added: trunk/explore/perf/STL/string/add-proxy/STLport-malloc/Makefile =================================================================== --- trunk/explore/perf/STL/string/add-proxy/STLport-malloc/Makefile (rev 0) +++ trunk/explore/perf/STL/string/add-proxy/STLport-malloc/Makefile 2006-10-16 21:05:09 UTC (rev 1329) @@ -0,0 +1,14 @@ +# -*- Makefile -*- Time-stamp: <05/12/27 00:41:26 ptr> + +SRCROOT := ../../../../.. +COMPILER_NAME := gcc + +ALL_TAGS := release-shared + + +include ../Makefile.inc +include ${SRCROOT}/Makefiles/top.mak + +DEFS += -D_STLP_USE_MALLOC + +release-shared: LDSEARCH = -L../../../build/lib/malloc -Wl,-rpath=../build/lib/malloc Modified: trunk/explore/perf/STL/string/test.sh =================================================================== --- trunk/explore/perf/STL/string/test.sh 2006-10-16 20:16:12 UTC (rev 1328) +++ trunk/explore/perf/STL/string/test.sh 2006-10-16 21:05:09 UTC (rev 1329) @@ -1,6 +1,6 @@ #!/bin/sh # -# Time-stamp: <06/10/16 18:25:07 ptr> +# Time-stamp: <06/10/17 00:57:02 ptr> # BASEDIR=${PWD}/../../.. @@ -65,6 +65,9 @@ echo $j `../stat.awk s.log` >> STLport-malloc.dat let j=j+1 done +let j=j+1 +runtest add-proxy/STLport-malloc +echo $j `../stat.awk s.log` >> STLport-malloc.dat rm -f STLport-newalloc.dat touch STLport-newalloc.dat Modified: trunk/explore/perf/STL/string-MT/add-proxy/Makefile =================================================================== --- trunk/explore/perf/STL/string-MT/add-proxy/Makefile 2006-10-16 20:16:12 UTC (rev 1328) +++ trunk/explore/perf/STL/string-MT/add-proxy/Makefile 2006-10-16 21:05:09 UTC (rev 1329) @@ -1,6 +1,6 @@ # -*- Makefile -*- Time-stamp: <05/12/27 00:39:55 ptr> -DIRS = STLport-default STLport-add-str-proxy libstdc++ +DIRS = STLport-default STLport-malloc STLport-add-str-proxy libstdc++ all: for d in $(DIRS); do \ Added: trunk/explore/perf/STL/string-MT/add-proxy/STLport-malloc/Makefile =================================================================== --- trunk/explore/perf/STL/string-MT/add-proxy/STLport-malloc/Makefile (rev 0) +++ trunk/explore/perf/STL/string-MT/add-proxy/STLport-malloc/Makefile 2006-10-16 21:05:09 UTC (rev 1329) @@ -0,0 +1,14 @@ +# -*- Makefile -*- Time-stamp: <05/12/27 00:41:26 ptr> + +SRCROOT := ../../../../.. +COMPILER_NAME := gcc + +ALL_TAGS := release-shared + + +include ../Makefile.inc +include ${SRCROOT}/Makefiles/top.mak + +DEFS += -D_STLP_USE_MALLOC + +release-shared: LDSEARCH = -L../../../build/lib/malloc -Wl,-rpath=../build/lib/malloc Modified: trunk/explore/perf/STL/string-MT/test.sh =================================================================== --- trunk/explore/perf/STL/string-MT/test.sh 2006-10-16 20:16:12 UTC (rev 1328) +++ trunk/explore/perf/STL/string-MT/test.sh 2006-10-16 21:05:09 UTC (rev 1329) @@ -1,6 +1,6 @@ #!/bin/sh # -# Time-stamp: <06/10/16 21:52:27 ptr> +# Time-stamp: <06/10/17 01:00:43 ptr> # BASEDIR=${PWD}/../../.. @@ -65,6 +65,9 @@ echo $j `../stat.awk s.log` >> STLport-malloc.dat let j=j+1 done +let j=j+1 +runtest add-proxy/STLport-malloc +echo $j `../stat.awk s.log` >> STLport-malloc.dat rm -f STLport-newalloc.dat touch STLport-newalloc.dat Modified: trunk/explore/perf/STL/strings.gplot =================================================================== --- trunk/explore/perf/STL/strings.gplot 2006-10-16 20:16:12 UTC (rev 1328) +++ trunk/explore/perf/STL/strings.gplot 2006-10-16 21:05:09 UTC (rev 1329) @@ -55,7 +55,7 @@ #pause(-1) -set output "alloc-2.2.5.eps" +set output "alloc-2_2_5.eps" plot [0.9:9.1] 'string/STLport-2.2.5.dat' using ($1):($6) notitle w l lt 1, \ 'string/STLport-2.2.5.dat' using ($1):($6):($7) title "node alloc" w yerrorbars lt 1, \ @@ -68,7 +68,7 @@ set output "strings-MT.eps" -plot [0.9:9.1][0:250] 'string-MT/STLport.dat' using ($1):($6) notitle w l lt 1, \ +plot [0.9:9.1] 'string-MT/STLport.dat' using ($1):($6) notitle w l lt 1, \ 'string-MT/STLport.dat' using ($1):($6):($7) title "node alloc" w yerrorbars lt 1, \ 'string-MT/libstd++.dat' using ($1):($6) notitle w l lt 2, \ 'string-MT/libstd++.dat' using ($1):($6):($7) title "libstd++" w yerrorbars lt 2, \ @@ -81,7 +81,7 @@ set output "strings-MT2.eps" -plot [0.9:9.1][0:50] 'string-MT/STLport.dat' using ($1):($6) notitle w l lt 1, \ +plot [0.9:9.1][0:25] 'string-MT/STLport.dat' using ($1):($6) notitle w l lt 1, \ 'string-MT/STLport.dat' using ($1):($6):($7) title "node alloc" w yerrorbars lt 1, \ 'string-MT/libstd++.dat' using ($1):($6) notitle w l lt 2, \ 'string-MT/libstd++.dat' using ($1):($6):($7) title "libstd++" w yerrorbars lt 2, \ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |