Re: Is there systematic performance comparison of std::string and c style string?
On Aug 13, 5:03 am, "Jim Langston" <tazmas...@rocketmail.com> wrote:
"Victor Bazarov" <v.Abaza...@comAcast.net> wrote in message
news:8JydnTuOLfB1WyLbnZ2dnUVZ_uejnZ2d@comcast.com...
Jim Langston wrote:
"Jim Langston" <tazmas...@rocketmail.com> wrote in message
news:H_Ovi.34$665.17@newsfe04.lga...
In my own testing the overhead of std::string .vs. c-style strings
was measured in microseconds. I.E. very negligable.
Wait,not micro, the one that is smaller than nano. Lets see, mili,
micro, nano, ... umm.. dang.
Pico? Atto? Femto?
Pico, that's it. It took about 4 pico seconds longer to
allocate a std::string than to use a c-style array in my
testing. Negligable for any application.
Picosecond differences are probably less than the resolution of
your measurement system; it would be more accurate to say that
you found no measurable difference. But that still doesn't tell
us anything, because we don't know what you were measuring.
Note too that for any given activity, the implementation of
std::string can make a significant difference. For some things,
the implementation in g++ is significantly faster than that in
VC++, for others, the reverse is true. (G++ uses reference
counting; VC++ deep copy with the small string optimization. If
you don't copy much, and most of your strings are short, VC++
will be faster; if you copy long strings a lot, g++.)
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34