views:

114

answers:

2

Text gets accumulates piecemeal before being sent to client.

Now we use own class that allocates memory for each piece as char massive. (Anyway, works like char[][] + std::list<char*>).

Then we build the whole string, convert it into std::sting and then create boost::asio::streambuf using it. That's slow enough, I assume. Correct me if I'm wrong.

I know, in many cases simple FILE type from stdio.h is used. How does it works? Allocates memory at every write into it. So, is it faster and is there any way to read into boost::asio::streambuf from FILE?

ADD: Hm. I've forgot one big thing :). The compilation of dlls and main application is made under few compilers, so it should have no stl stuff inside it ... Because it usually cause a lot of problems, while executing dlls.

+2  A: 

I have no idea how efficient it is, but I usually use a ostringstream for that sort of thing

psm321
Same here, it does the job and is built in (no extra libraries required) just do #include <sstream>.
Amos
I don't like non-stdio.h I\O operations, so that's what I meant saying FILE type from stdio.h. It must be faster. (Don't like streams' I\O, anyway.)
MInner
Why do you assume it must be faster? The C++ library is built on the same base functions and written by some very smart people that can probably optimize things better than you or I
psm321
+1  A: 

Check out http://www.sgi.com/tech/stl/Rope.html

Timmmm
Great thing. I'll just have to check out on the content of stl inside it. And compare speed of rope, FILE type and our stuff (I assume rope, as a complicated project of big group of programmers should work faster). Thanks.
MInner
hah ) I was getting ready to check out of content of stl in this thing :)). Never knew about such stl container.
MInner