diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
commit | 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch) | |
tree | e5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/boost/libs/format/benchmark | |
parent | Initial commit. (diff) | |
download | ceph-upstream.tar.xz ceph-upstream.zip |
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/libs/format/benchmark')
-rw-r--r-- | src/boost/libs/format/benchmark/Jamfile | 27 | ||||
-rw-r--r-- | src/boost/libs/format/benchmark/bench_format.cpp | 356 | ||||
-rw-r--r-- | src/boost/libs/format/benchmark/results.txt | 293 |
3 files changed, 676 insertions, 0 deletions
diff --git a/src/boost/libs/format/benchmark/Jamfile b/src/boost/libs/format/benchmark/Jamfile new file mode 100644 index 00000000..0a420ab3 --- /dev/null +++ b/src/boost/libs/format/benchmark/Jamfile @@ -0,0 +1,27 @@ +# Boost.Format Library benchmark Jamfile +# +# Copyright (c) 2003 Samuel Krempp +# +# Distributed under the Boost Software License, Version 1.0. +# See www.boost.org/LICENSE_1_0.txt +# + +project libs/format/benchmark + : requirements + <toolset>msvc:<define>_CRT_SECURE_NO_WARNINGS + ; + +exe bench_format_no_locale + : bench_format.cpp + : <define>BOOST_NO_STD_LOCALE <location-prefix>no_locale + ; + +exe bench_format_normal + : bench_format.cpp + : <location-prefix>normal + ; + +exe bench_format_no_reuse_stream + : bench_format.cpp + : <include>alts <define>BOOST_FORMAT_NO_OSS_MEMBER <location-prefix>no_reuse_stream + ; diff --git a/src/boost/libs/format/benchmark/bench_format.cpp b/src/boost/libs/format/benchmark/bench_format.cpp new file mode 100644 index 00000000..393df758 --- /dev/null +++ b/src/boost/libs/format/benchmark/bench_format.cpp @@ -0,0 +1,356 @@ +// -*- C++ -*- +// Boost general library 'format' --------------------------- +// See http://www.boost.org for updates, documentation, and revision history. + +// Copyright (c) 2001 Samuel Krempp +// krempp@crans.ens-cachan.fr +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// several suggestions from Jens Maurer + +// ------------------------------------------------------------------------------ +// bench_variants.cc : do the same task, with sprintf, stream, and format +// and compare their times. + +// This benchmark is provided purely for information. +// It might not even compile as-is, +// or not give any sensible results. +// (e.g., it expects sprintf to be POSIX compliant) + +// ------------------------------------------------------------------------------ + + +#include <iostream> +#include <iomanip> +#include <cstdio> // sprintf +#include <cstring> +#include <fstream> +#include <cmath> // floor +#include <boost/timer.hpp> +#include <vector> + +#include <boost/format.hpp> + +// portable /dev/null stream equivalent, by James Kanze, http://www.gabi-soft.de +class NulStreambuf : public std::streambuf +{ +public: + NulStreambuf() { + setp( dummyBuffer , dummyBuffer + 64 ) ; + } + virtual int overflow( int c ); + virtual int underflow(); +private: + char dummyBuffer[ 64 ] ; +} ; + +class NulStream : public std::basic_ostream<char, std::char_traits<char> > +{ +public: + NulStream(); + virtual ~NulStream(); + NulStreambuf* rdbuf() { + return static_cast< NulStreambuf* >( + ((std::basic_ostream<char, std::char_traits<char> > *) this) -> rdbuf() ) ; + } +} ; + + +//------------------------------------------------------------------------------------- +// NulStream implementation + +NulStream::NulStream() : std::basic_ostream<char, std::char_traits<char> > (NULL) { + init( new NulStreambuf ) ; +} + +NulStream::~NulStream() { + delete rdbuf() ; +} + +int NulStreambuf::underflow(){ return std::ios::traits_type::eof(); +} + +int NulStreambuf::overflow( int c ){ + setp( dummyBuffer , dummyBuffer + 64 ) ; + return (c == std::ios::traits_type::eof()) ? '\0' : c ; +} + + + +// ------------------------------------------------------------------------------------- + +namespace benchmark { + +static int NTests = 300000; + +//static std::stringstream nullStream; +static NulStream nullStream; +static double tstream, tpf; +//static const std::string fstring="%3$#x %1$20.10E %2$g %3$d \n"; +static const std::string fstring="%3$0#6x %1$20.10E %2$g %3$0+5d \n"; +static const double arg1=45.23; +static const double arg2=12.34; +static const int arg3=23; +static const std::string res = +"0x0017 4.5230000000E+01 12.34 +0023 \n"; +//static const std::string res = "23.0000 4.5230000000E+01 12.34 23 \n"; + +void test_sprintf(); +void test_nullstream(); +void test_opti_nullstream(); +void test_parsed_once_format(); +void test_reused_format(); +void test_format(); +void test_try1(); +void test_try2(); + +void test_sprintf() +{ + using namespace std; + + vector<char> bufr; + bufr.reserve(4000); + char *buf = &bufr[0]; + + // Check that sprintf is Unix98 compatible on the platform : + sprintf(buf, fstring.c_str(), arg1, arg2, arg3); + if( strncmp( buf, res.c_str(), res.size()) != 0 ) { + cerr << endl << buf; + } + // time the loop : + boost::timer chrono; + for(int i=0; i<NTests; ++i) { + sprintf(buf, fstring.c_str(), arg1, arg2, arg3); + } + tpf=chrono.elapsed(); + cout << left << setw(20) <<"printf time"<< right <<":" << tpf << endl; +} + +void test_try1() +{ + using namespace std; + boost::io::basic_oaltstringstream<char> oss; + oss << boost::format(fstring) % arg1 % arg2 % arg3; + boost::timer chrono; + size_t dummy=0; + for(int i=0; i<NTests; ++i) { + dummy += oss.cur_size(); + } + double t = chrono.elapsed(); + cout << left << setw(20) <<"try1 time"<< right <<":" << setw(5) << t + << ", = " << t / tpf << " * printf " + << ", = " << t / tstream << " * nullStream \n"; +} + +void test_try2() +{ + using namespace std; + boost::io::basic_oaltstringstream<char> oss; + oss << boost::format(fstring) % arg1 % arg2 % arg3; + oss << "blas 34567890GGGGGGGGGGGGGGGGGGGGGGGGGGGGggggggggggggggggggggggggggg " << endl; + string s = oss.cur_str(); + oss << s << s << s; + oss.clear_buffer(); + oss << s << s; + s = oss.cur_str(); + boost::timer chrono; + size_t dummy=0; + for(int i=0; i<NTests; ++i) { + dummy += oss.cur_size(); + } + double t = chrono.elapsed(); + cout << left << setw(20) <<"try2 time"<< right <<":" << setw(5) << t + << ", = " << t / tpf << " * printf " + << ", = " << t / tstream << " * nullStream \n"; +} + +void do_stream(std::ostream& os) { + using namespace std; + std::ios_base::fmtflags f = os.flags(); + os << hex << showbase << internal << setfill('0') << setw(6) << arg3 + << dec << noshowbase << right << setfill(' ') + << " " + << scientific << setw(20) << setprecision(10) << uppercase << arg1 + << setprecision(6) << nouppercase ; + os.flags(f); + os << " " << arg2 << " " + << showpos << setw(5) << internal << setfill('0') << arg3 << " \n" ; + os.flags(f); +} + +void test_nullstream() +{ + using namespace std; + boost::timer chrono; + boost::io::basic_oaltstringstream<char> oss; + + { + do_stream(oss); + if(oss.str() != res ) { + cerr << endl << oss.str() ; + } + } + + for(int i=0; i<NTests; ++i) { + do_stream(nullStream); + } + +// for(int i=0; i<NTests; ++i) { +// std::ios_base::fmtflags f0 = nullStream.flags(); +// nullStream << hex << showbase << arg3 +// << dec << noshowbase << " " +// << scientific << setw(20) << setprecision(10) << uppercase << arg1 +// << setprecision(0); +// nullStream.flags(f0); +// nullStream << " " << arg2 << " " << arg3 << " \n" ; + +// } + double t = chrono.elapsed(); + cout << left << setw(20) <<"ostream time"<< right <<":" << setw(5) << t + << ", = " << t / tpf << " * printf \n"; + tstream = t; +} + +void test_opti_nullstream() +{ + using namespace std; + boost::timer chrono; + boost::io::basic_oaltstringstream<char> oss; + //static const std::string fstring="%3$#x %1$20.10E %2$g %3$d \n"; + + std::ios_base::fmtflags f0 = oss.flags(), f1, f2; + streamsize p0 = oss.precision(); + { + oss << hex << showbase; + f1 = oss.flags(); + oss << arg3; + + oss.flags(f0); + oss << " " << scientific << setw(20) << setprecision(10) << uppercase; + f2 = oss.flags(); + oss << arg1; + + oss.flags(f0); oss.precision(p0); + oss << " " << arg2 << " " << arg3 << " \n" ; + + if(oss.str() != res ) { + cerr << endl << oss.str() ; + } + } + + for(int i=0; i<NTests; ++i) { + nullStream.flags(f1); + nullStream << arg3; + + nullStream << setw(20) << setprecision(10); + nullStream.flags(f2); + nullStream << arg1; + + nullStream.flags(f0); nullStream.precision(p0); + nullStream << " " << arg2 << " " << arg3 << " \n" ; + } + double t = chrono.elapsed(); + cout << left << setw(20) <<"opti-stream time"<< right <<":" << setw(5) << t + << ", = " << t / tpf << " * printf \n"; + // tstream = t; +} + +void test_parsed_once_format() +{ + using namespace std; + static const boost::format fmter(fstring); + + boost::io::basic_oaltstringstream<char> oss; + oss << boost::format(fmter) % arg1 % arg2 % arg3 ; + if( oss.str() != res ) { + cerr << endl << oss.str(); + } + + // not only is the format-string parsed once, + // but also the buffer of the internal stringstream is already allocated. + + boost::timer chrono; + for(int i=0; i<NTests; ++i) { + nullStream << boost::format(fmter) % arg1 % arg2 % arg3; + } + double t=chrono.elapsed(); + cout << left << setw(20) <<"parsed-once time"<< right <<":" << setw(5) << t + << ", = " << t / tpf << " * printf " + << ", = " << t / tstream << " * nullStream \n"; +} + +void test_reused_format() +{ + using namespace std; + boost::io::basic_oaltstringstream<char> oss; + oss << boost::format(fstring) % arg1 % arg2 % arg3; + if(oss.str() != res ) { + cerr << endl << oss.str(); + } + + boost::timer chrono; + boost::format fmter; + for(int i=0; i<NTests; ++i) { + nullStream << fmter.parse(fstring) % arg1 % arg2 % arg3; + } + double t = chrono.elapsed(); + cout << left << setw(20) <<"reused format time"<< right <<":" << setw(5) << t + << ", = " << t / tpf << " * printf " + << ", = " << t / tstream << " * nullStream \n"; +} + +void test_format() +{ + using namespace std; + boost::io::basic_oaltstringstream<char> oss; + oss << boost::format(fstring) % arg1 % arg2 % arg3; + if(oss.str() != res ) { + cerr << endl << oss.str(); + } + + boost::timer chrono; + for(int i=0; i<NTests; ++i) { + nullStream << boost::format(fstring) % arg1 % arg2 % arg3; + } + double t = chrono.elapsed(); + cout << left << setw(20) <<"format time"<< right <<":" << setw(5) << t + << ", = " << t / tpf << " * printf " + << ", = " << t / tstream << " * nullStream \n"; +} + +} // benchmark + +int main(int argc, char * argv[]) { + using namespace benchmark; + using namespace boost; + using namespace std; + const string::size_type npos = string::npos; + + string choices = ""; + if (1<argc) { + choices = (argv[1]); // profiling is easier launching only one. + NTests = 1000 * 1000; // andmoreprecise with many iterations + cout << "choices (" << choices << ") \n"; + } + + if (choices == "" || choices.find('p') != npos) + test_sprintf(); + if (choices == "" || choices.find('n') != npos) + test_nullstream(); + if (choices == "" || choices.find('1') != npos) + test_parsed_once_format(); + if (choices == "" || choices.find('r') != npos) + test_reused_format(); + if (choices == "" || choices.find('f') != npos) + test_format(); + if (choices.find('t') != npos) + test_try1(); + if (choices.find('y') != npos) + test_try2(); + if (choices.find('o') != npos) + test_opti_nullstream(); + return 0; +} + diff --git a/src/boost/libs/format/benchmark/results.txt b/src/boost/libs/format/benchmark/results.txt new file mode 100644 index 00000000..4a884def --- /dev/null +++ b/src/boost/libs/format/benchmark/results.txt @@ -0,0 +1,293 @@ +// Copyright (c) 2001 Samuel Krempp +// krempp@crans.ens-cachan.fr +// Distributed under the Boost Software License, Version 1.0. (See accompany- +// ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +// This benchmark is provided purely for information. +// It might not even compile as-is, +// or not give any sensible results. +// (e.g., it expects sprintf to be POSIX compliant) + + new results ( with outsstream vs. stringstream) + +bjam -sTOOLS="gcc intel-linux-7.1" -sBUILD="release" + +( -sBUILD="profile" for profiling..) + + + "_no_reuse_stream" "_stringstr" "_strstream" _no_locale + +intel-linux-7.1 + +for comp in gcc ; do + echo "\n------------------- Compiler $comp : ---------------- " + for var in _overloads _basicfmt _normal; do + echo "\n-- Variant **" $var "**" : + texe=$EXEBOOST/libs/format/benchmark/bench_format${var}/${comp}/release/bench_format${var} ; + ls -l $texe; + $texe + done +done + + +// stringstream recréé chaque fois. +-- Variant ** _normal ** : +-rwx--x--x 1 sam users 61952 Sep 17 03:13 /home/data/zStore/BBoost/bin/boost//libs/format/benchmark/bench_format_normal/gcc/release/bench_format_normal +printf time :2.16 +ostream time : 3.69, = 1.70833 * printf +parsed-once time : 8.45, = 3.91204 * printf , = 2.28997 * nullStream +reused format time :10.94, = 5.06481 * printf , = 2.96477 * nullStream +format time :10.97, = 5.0787 * printf , = 2.9729 * nullStream + + +Pour le parsing. step 1 : scan_not + str2int (version Iter const& qques % mieux) + +------------------- Compiler gcc : ---------------- + +-- Variant ** _overloads ** : +-rwx--x--x 1 sam users 52864 2003-09-12 02:59 /home/sam/progs/Boost/bin/BBoost//libs/format/benchmark/bench_format_overloads/gcc/release/bench_format_overloads +printf time :2.21 +ostream time : 3.57, = 1.61538 * printf +parsed-once time : 4.93, = 2.23077 * printf , = 1.38095 * nullStream +reused format time : 9.25, = 4.18552 * printf , = 2.59104 * nullStream +format time :10.33, = 4.67421 * printf , = 2.89356 * nullStream + +-- Variant ** _basicfmt ** : +-rwx--x--x 1 sam users 52864 2003-09-12 03:00 /home/sam/progs/Boost/bin/BBoost//libs/format/benchmark/bench_format_basicfmt/gcc/release/bench_format_basicfmt +printf time :2.2 +ostream time : 3.57, = 1.62273 * printf +parsed-once time : 4.85, = 2.20455 * printf , = 1.35854 * nullStream +reused format time : 9.25, = 4.20455 * printf , = 2.59104 * nullStream +format time :10.29, = 4.67727 * printf , = 2.88235 * nullStream + +-- Variant ** _normal ** : +-rwx--x--x 1 sam users 53088 2003-09-12 03:00 /home/sam/progs/Boost/bin/BBoost//libs/format/benchmark/bench_format_normal/gcc/release/bench_format_normal +printf time :2.27 +ostream time : 3.47, = 1.52863 * printf +parsed-once time : 4.79, = 2.11013 * printf , = 1.3804 * nullStream +reused format time : 9.88, = 4.35242 * printf , = 2.84726 * nullStream +format time :10.97, = 4.8326 * printf , = 3.16138 * nullStream + +------------------------------------------------------------------------------------------------- +Overload : int, double char * -> put_simple : +#if defined(BOOST_FORMAT_OVERLOADS) + template<class T> + basic_format& operator%(const char* x) + { return io::detail::feed_overloaded(*this,x); } + template<class T> + basic_format& operator%(const double x) + { return io::detail::feed_overloaded(*this,x); } + template<class T> + basic_format& operator%(const int x) + { return io::detail::feed_overloaded(*this,x); } +#endif + + // put overloads for common types (-> faster) + template< class Ch, class Tr, class T> + void put_simple( T x, + const format_item<Ch, Tr>& specs, + std::basic_string<Ch, Tr> & res, + io::basic_outsstream<Ch, Tr>& oss_ ) + { + typedef std::basic_string<Ch, Tr> string_t; + typedef format_item<Ch, Tr> format_item_t; + + specs.fmtstate_.apply_on(oss_); + const std::ios_base::fmtflags fl=oss_.flags(); + const std::streamsize w = oss_.width(); + + if(w!=0) + oss_.width(0); + put_last( oss_, x); + const Ch * res_beg = oss_.begin(); + std::streamsize res_size = std::min(specs.truncate_, oss_.pcount()); + int prefix_space = 0; + if(specs.pad_scheme_ & format_item_t::spacepad) + if( res_size == 0 || ( res_beg[0] !='+' && res_beg[0] !='-' )) + prefix_space = 1; + mk_str(res, res_beg, res_size, w, oss_.fill(), fl, + prefix_space, (specs.pad_scheme_ & format_item_t::centered) !=0 ); + clear_buffer( oss_); + } // end- put_simple(..) + + + +------------------- Compiler gcc : ---------------- + +-- Variant ** _overloads ** : +-rwx--x--x 1 sam users 52832 2003-09-12 00:17 /home/sam/progs/Boost/bin/BBoost//libs/format/benchmark/bench_format_overloads/gcc/release/bench_format_overloads +printf time :2.13 +ostream time : 2.91, = 1.3662 * printf +parsed-once time : 4.48, = 2.10329 * printf , = 1.53952 * nullStream +reused format time : 9.42, = 4.42254 * printf , = 3.23711 * nullStream +format time : 11.1, = 5.21127 * printf , = 3.81443 * nullStream + +RERUN +printf time :2.09 +ostream time : 2.92, = 1.39713 * printf +parsed-once time : 4.43, = 2.11962 * printf , = 1.51712 * nullStream +reused format time : 9.29, = 4.44498 * printf , = 3.18151 * nullStream +format time :11.05, = 5.28708 * printf , = 3.78425 * nullStream + +-- Variant ** _basicfmt ** : +-rwx--x--x 1 sam users 52832 2003-09-12 00:17 /home/sam/progs/Boost/bin/BBoost//libs/format/benchmark/bench_format_basicfmt/gcc/release/bench_format_basicfmt +printf time :2.16 +ostream time : 3.01, = 1.39352 * printf +parsed-once time : 4.41, = 2.04167 * printf , = 1.46512 * nullStream +reused format time : 9.61, = 4.44907 * printf , = 3.19269 * nullStream +format time :11.02, = 5.10185 * printf , = 3.66113 * nullStream + +-- Variant ** _no_locale ** : +-rwx--x--x 1 sam users 52192 2003-09-12 00:09 /home/sam/progs/Boost/bin/BBoost//libs/format/benchmark/bench_format_no_locale/gcc/release/bench_format_no_locale +printf time :2.1 +ostream time : 2.87, = 1.36667 * printf +parsed-once time : 4.44, = 2.11429 * printf , = 1.54704 * nullStream +reused format time : 8.21, = 3.90952 * printf , = 2.86063 * nullStream +format time : 9.25, = 4.40476 * printf , = 3.223 * nullStream + +-- Variant ** _normal ** : +-rwx--x--x 1 sam users 53056 2003-09-12 00:17 /home/sam/progs/Boost/bin/BBoost//libs/format/benchmark/bench_format_normal/gcc/release/bench_format_normal +printf time :2.18 +ostream time : 2.92, = 1.33945 * printf +parsed-once time : 5.75, = 2.63761 * printf , = 1.96918 * nullStream +reused format time :10.27, = 4.71101 * printf , = 3.51712 * nullStream + + + + + + + + + + + + + + + + + + + + +------------------- Compiler gcc : ---------------- + +-- Variant ** _normal ** : +-rwx--x--x 1 sam users 49280 2003-09-10 21:12 /home/sam/progs/Boost/bin/BBoost//libs/format/benchmark/bench_format_normal/gcc/release/bench_format_normal +printf time :2.16 +ostream time : 2.81, = 1.30093 * printf +stored format time :11.56, = 5.35185 * printf , = 4.11388 * nullStream +format time :18.69, = 8.65278 * printf , = 6.65125 * nullStream + +-- Variant ** _static_stream ** : +-rwx--x--x 1 sam users 45856 2003-09-10 21:13 /home/sam/progs/Boost/bin/BBoost//libs/format/benchmark/bench_format_static_stream/gcc/release/bench_format_static_stream +printf time :2.1 +ostream time : 2.79, = 1.32857 * printf +stored format time : 4.5, = 2.14286 * printf , = 1.6129 * nullStream +format time :10.05, = 4.78571 * printf , = 3.60215 * nullStream + +-- Variant ** _basicfmt ** : +-rwx--x--x 1 sam users 47200 2003-09-10 21:13 /home/sam/progs/Boost/bin/BBoost//libs/format/benchmark/bench_format_basicfmt/gcc/release/bench_format_basicfmt +printf time :2.22 +ostream time : 2.88, = 1.2973 * printf +stored format time : 4.45, = 2.0045 * printf , = 1.54514 * nullStream +format time :11.67, = 5.25676 * printf , = 4.05208 * nullStream + + + + + +The cost of imbuing locale after each object is fed : + +------------------- Compiler gcc : ---------------- +-- Variant _normal : +-rwx--x--x 1 sam users 49920 2003-09-10 20:23 /home/sam/progs/Boost/bin/BBoost//libs/format/benchmark/bench_format_normal/gcc/release/bench_format_normal +printf time :2.21 +ostream time : 3.1, = 1.40271 * printf +stored format time :11.53, = 3.71935 * stream +format time :18.86, = 6.08387 * stream + +-- Variant _static_stream : +-rwx--x--x 1 sam users 43232 2003-09-10 20:24 /home/sam/progs/Boost/bin/BBoost//libs/format/benchmark/bench_format_static_stream/gcc/release/bench_format_static_stream +printf time :2.19 +ostream time : 3.09, = 1.41096 * printf +stored format time : 4.63, = 1.49838 * stream +format time :10.12, = 3.27508 * stream + +-- Variant _basicfmt : +-rwx--x--x 1 sam users 45760 2003-09-10 20:24 /home/sam/progs/Boost/bin/BBoost//libs/format/benchmark/bench_format_basicfmt/gcc/release/bench_format_basicfmt +printf time :2.23 +ostream time : 3.14, = 1.40807 * printf +stored format time : 4.61, = 1.46815 * stream +format time :11.33, = 3.60828 * stream + + + + + + + +------------------- Compiler gcc : ---------------- +-- Variant _normal : +printf time :2.15 +ostream time :4.42, = 2.05581 * printf +stored format time :5.85, = 1.32353 * stream +format time :11.53, = 2.6086 * stream +-- Variant _no_reuse_stream : +printf time :2.13 +ostream time :4.4, = 2.06573 * printf +stored format time :11.1, = 2.52273 * stream +format time :14.3, = 3.25 * stream +-- Variant _stringstr : +printf time :2.01 +ostream time :4.42, = 2.199 * printf +stored format time :7.92, = 1.79186 * stream +format time :12.8, = 2.89593 * stream + +------------------- Compiler intel-linux-7.1 : ---------------- +-- Variant _normal : +printf time :2.08 +ostream time :4.49, = 2.15865 * printf +stored format time :5.3, = 1.1804 * stream +format time :17.8, = 3.96437 * stream +-- Variant _no_reuse_stream : +printf time :2.09 +ostream time :4.37, = 2.09091 * printf +stored format time :10.07, = 2.30435 * stream +format time :14.46, = 3.30892 * stream +-- Variant _stringstr : +printf time :1.99 +ostream time :5.16, = 2.59296 * printf +stored format time :5.83, = 1.12984 * stream +format time :17.42, = 3.37597 * stream + + + + +// older Result with gcc-3.03 on linux : + +// With flag -g : + +/*** +printf time :1.2 +ostream time :2.84, = 2.36667 * printf +stored format time :8.91, = 3.13732 * stream +format time :15.35, = 5.40493 * stream +format3 time :21.83, = 7.68662 * stream +***/ + + +// With flag -O + +/*** +printf time :1.16 +ostream time :1.94, = 1.67241 * printf +stored format time :3.68, = 1.89691 * stream +format time :6.31, = 3.25258 * stream +format3 time :9.04, = 4.65979 * stream +***/ + +// ==> that's quite acceptable. + +// ------------------------------------------------------------------------------ |