B
Boris Du¹ek
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
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