22 Jun
2010
22 Jun
'10
1:56 p.m.
I'm in the process of writing a logging library and I noticed that each
call to print out ptime took about ~50us. Even just printing out the
duration time_of_day cost ~20us.
I'm using boost1.43 with g++ (GCC) 4.4.3
g++ -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall
-pthread -DNDEBUG
I was able to do the same thing for <1us not using stream ops (see code
below).
Does anyone care to optimize this stuff? I'm considering specializing
my own boost::date_time::ostream_time_duration_formatter to override to
slow impl.
template<typename int_t>
void printDecimal(int_t d,int places,char* out){
int_t rest=d;
for(int i=0;i