This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
A simple benchmark(*) designed to compare the efficiency of our implementation of C++ Standard iostreams revealed a regression in the performance of the gcc 3.2 optimizer on SPARC with respect to gcc 2.95.2. To verify the regression, I also compiled the same benchmark against STLport 4.5, and reproduced similar results. The executive summary is that the benchmark runs from 10% to 30% slower when compiled with gcc 3.2 than when compiled with gcc 2.95.2 on SPARC using the same set of compiler options. The good news is that the benchmark still runs up to 7% faster when compiled with gcc 3.2 than when compiled with SunPro 5.3 against the same implementation of the C++ Standard iostreams (Rogue Wave libstd 3.1). An interesting datapoint for libstdc++ folks might be that the gcc 3.2 C++ Standard iostream implementation is nearly three times slower than the next slowest implementation on SunOS (SunPro 5.3's libstd 2.1.1) and 5 times slower than the fastest tested implementation on SunOS (SunPro 5.3 with STLport 4.5). (*) The benchmark formats a large number of integers (octal, decimal, and hexadecimal) in a tight loop to stdout redirected to /dev/null using C stdio as a baseline and iostreams for comparison along the following lines (the actual program is slightly more complicated): #include <iostream> #include <string.h> #include <stdlib.h> int main (int argc, char *argv[]) { std::cout.sync_with_stdio (false); const int n = argc > 1 ? atoi (argv [1]) : 0; const bool stdio = argc > 2 ? !strcmp (argv [2], "stdio") : true; for (int i = 0; i != n; ++i) { if (stdio) printf ("%d ", i); else std::cout << i << ' '; } } The detailed comparison results are below. The BASE column in the first row for each configuration denotes the baseline (octal integer formatting using C stdio), each subsequent row is a multiple of the baseline. For example, in the first table below, decimal integer formatting using Classic Iostreams is 1.96 times slower than octal formatting using stdio. All measurements were done on a 4-CPU Ultra SPARC machine with 1GB RAM running SunOS 5.7 and reflect the sum of user and system times on an otherwise unloaded machine. libstd 2.1.1 and libstd 3.1 below are versions 2.1.1 and 3.1, respectively, of the Rogue Wave implementation of the C++ Standard Library. I hope that these results are helpful in improving both the gcc optimizer and the quality of the gcc implementation of the C++ Standard iostreams. Regards Martin # gcc 2.95.2, Classic Iostreams -O2 TEST NAME LIB BASE fmat_oct stdio 1.00 fmat_oct classic 0.65 fmat_dec stdio 1.56 fmat_dec classic 1.96 x slower than octal stdio fmat_hex stdio 0.92 fmat_hex classic 0.64 # gcc 2.95.2, Classic Iostreams -O3 -fomit-frame-pointer TEST NAME LIB BASE fmat_oct stdio 1.00 fmat_oct classic 0.62 fmat_dec stdio 1.51 fmat_dec classic 1.92 fmat_hex stdio 0.96 fmat_hex classic 0.58 # gcc 2.95.2, libstd 3.1 -O2 TEST NAME LIB BASE fmat_oct stdio 1.00 fmat_oct iostream 1.47 fmat_dec stdio 1.57 fmat_dec iostream 1.81 fmat_hex stdio 0.95 fmat_hex iostream 1.32 # gcc 2.95.2, libstd 3.1 -O3 -fomit-frame-pointer TEST NAME LIB BASE fmat_oct stdio 1.00 fmat_oct iostream 1.45 fmat_dec stdio 1.54 fmat_dec iostream 1.77 fmat_hex stdio 0.96 fmat_hex iostream 1.30 # gcc 2.95.2, STLport 4.5 -O2 TEST NAME LIB BASE fmat_oct stdio 1.00 fmat_oct iostream 1.17 fmat_dec stdio 1.58 fmat_dec iostream 3.20 fmat_hex stdio 0.98 fmat_hex iostream 1.05 # gcc 3.2, libstd 3.1 -O2 TEST NAME LIB BASE fmat_oct stdio 1.00 fmat_oct iostream 1.98 fmat_dec stdio 1.54 fmat_dec iostream 2.28 fmat_hex stdio 0.95 fmat_hex iostream 1.76 # gcc 3.2, libstd 3.1 -O3 -fomit-frame-pointer TEST NAME LIB BASE fmat_oct stdio 1.00 fmat_oct iostream 2.12 fmat_dec stdio 1.55 fmat_dec iostream 2.35 fmat_hex stdio 0.95 fmat_hex iostream 1.89 # gcc 3.2, STLport 4.5 -O2 TEST NAME LIB BASE fmat_oct stdio 1.00 fmat_oct iostream 1.39 fmat_dec stdio 1.53 fmat_dec iostream 3.34 fmat_hex stdio 0.94 fmat_hex iostream 1.24 # gcc 3.2, STLport 4.5 -O3 -fomit-frame-pointer TEST NAME LI BBASE fmat_int stdio 1.00 fmat_int iostream 1.12 fmat_int stdio 1.29 fmat_int iostream 2.77 fmat_int stdio 0.96 fmat_int iostream 1.01 # gcc 3.2, libstdc++ -O2 TEST NAME LIB BASE fmat_oct stdio 1.00 fmat_oct iostream 9.20 fmat_dec stdio 1.54 fmat_dec iostream 9.52 fmat_hex stdio 0.95 fmat_hex iostream 8.66 # gcc 3.2, libstdc++ -O3 -fomit-frame-pointer TEST NAME LIB BASE fmat_oct stdio 1.00 fmat_oct iostream 9.11 fmat_dec stdio 1.56 fmat_dec iostream 9.41 fmat_hex stdio 0.96 fmat_hex iostream 8.55 # SunPro 5.3, libstd 3.1 -O TEST NAME LIB BASE fmat_oct stdio 1.00 fmat_oct iostream 2.23 fmat_dec stdio 1.58 fmat_dec iostream 2.25 fmat_hex stdio 0.95 fmat_hex iostream 1.98 # SunPro 5.3, libstd 2.1.1 -O TEST NAME LIB BASE fmat_oct stdio 1.00 fmat_oct iostream 3.09 fmat_dec stdio 1.55 fmat_dec iostream 3.34 fmat_hex stdio 0.93 fmat_hex iostream 2.84
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |