Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Utility to report performance characteristics of standard C/C++library implementation?

Reply
Thread Tools

Utility to report performance characteristics of standard C/C++library implementation?

 
 
Boris Dušek
Guest
Posts: n/a
 
      06-15-2009
Hello,

I would like to get more insight into how much some common operations
in C/C++ standard library cost in terms of performance, and also how
these costs differ between different platforms (like vc9 vs. vc10 beta
1 vs. g++-4.1.2/Linux-32 vs. g++-4.0.1/OS X). I started to write a
small utility for that with stuff I am currently interested in (like
cost of malloc/free, cost of "string str; copy(data, data + n,
back_inserter(str)" versus cost of "string str(data, data + n)",
similar with transform versus boost::transform_iterator). Also I
output allocation strategy for vector and string (and learn libstdc++
is strictly exponential with base of 2, while Microsoft's string
implementation has minimal storage allocated and then behaves
~exponentially, but not with base of 2.

But I think I am probably reinventing the wheel. Isn't there a utility
that is portable and assesses such characteristics and outputs them
for study by an interested developer (possibly calibrating the results
w.r.t. CPU power/load)? I also guess such utility would be great for
developers of standard libraries, since they can both catch
performance regressions and compare with competition, so I hope there
is something available.

Thanks for any pointers,
Boris Dušek
 
Reply With Quote
 
 
 
 
Jorgen Grahn
Guest
Posts: n/a
 
      06-16-2009
On Mon, 15 Jun 2009 04:36:03 -0700 (PDT), Boris Dušek <(E-Mail Removed)> wrote:
> Hello,
>
> I would like to get more insight into how much some common operations
> in C/C++ standard library cost in terms of performance, and also how
> these costs differ between different platforms (like vc9 vs. vc10 beta
> 1 vs. g++-4.1.2/Linux-32 vs. g++-4.0.1/OS X). I started to write a
> small utility for that with stuff I am currently interested in (like
> cost of malloc/free, cost of "string str; copy(data, data + n,
> back_inserter(str)" versus cost of "string str(data, data + n)",
> similar with transform versus boost::transform_iterator). Also I
> output allocation strategy for vector and string (and learn libstdc++
> is strictly exponential with base of 2, while Microsoft's string
> implementation has minimal storage allocated and then behaves
> ~exponentially, but not with base of 2.
>
> But I think I am probably reinventing the wheel. Isn't there a utility
> that is portable and assesses such characteristics and outputs them
> for study by an interested developer


There is. Under Unix, I use my shell's 'time' command, and a profiler
(gprof). That's what people here mean when they say "don't guess,
measure" when discussing optimization.

> (possibly calibrating the results
> w.r.t. CPU power/load)?


Probably not worth trying. There are too many factors involved (cache
characteristics, for example).

> I also guess such utility would be great for
> developers of standard libraries, since they can both catch
> performance regressions and compare with competition, so I hope there
> is something available.


They should be interested in performance yes, but they are a tiny,
tiny minority of all C++ users. It's mostly ordinaty users like you
and me who should use such tools, and when we hit a bottleneck it is
almost never a fixable bottleneck in the standard library but our own
fault.

/Jorgen

--
// Jorgen Grahn <grahn@ Ph'nglui mglw'nafh Cthulhu
\X/ snipabacken.se> R'lyeh wgah'nagl fhtagn!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
help about browser characteristics indra ASP .Net 1 08-29-2005 12:19 PM
disable asp.net characteristics Aaron ASP .Net 2 03-07-2005 07:18 PM
default servlet open-window characteristics Gary N. Java 2 01-09-2004 11:35 PM
Coolpix 950 infra red characteristics Tobit Digital Photography 5 09-30-2003 08:23 PM
controlling page characteristics gb ASP .Net 1 08-21-2003 11:58 PM



Advertisments