Boost logo

Boost Users :

From: Bill Lear (rael_at_[hidden])
Date: 2007-07-27 15:35:54


I have been searching the world in vain for a stringstream that works
with a static buffer, and does not use the heap for memory allocation.
We have an application that uses lots (12-16Gb) of memory. This puts
a strain on the memory allocation routines, and when we want to create
a small string we find that stringstream is very, very expensive, and
sprintf into a static buffer much, much faster.

Does boost provide anything like this?

This actually came up when we realized that boost lexical_cast was
using stringstream. When we replaced it with sprintf, our runtimes
(when memory usage was very high) went down significantly. I should
also point out that ANYTHING we did with dynamic memory at that point
in the application (vector::push_back, for example) was hideously
slow.

I'd like to have the best of both worlds: the relatively clear
syntax of the ostringstream inserters, working on a static buffer.

Any help (code samples especially) appreciated.

Bill


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net