3

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.

NmdMystery
  • 2,778
  • 3
  • 32
  • 60
Ben Usman
  • 7,969
  • 6
  • 46
  • 66

2 Answers2

3

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

psm321
  • 280
  • 2
  • 7
  • Same here, it does the job and is built in (no extra libraries required) just do #include . – Amos Mar 19 '10 at 14:25
  • 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.) – Ben Usman Mar 19 '10 at 20:14
  • 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 Mar 23 '10 at 19:34
1

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

Timmmm
  • 88,195
  • 71
  • 364
  • 509
  • 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. – Ben Usman Mar 19 '10 at 20:12
  • hah ) I was getting ready to check out of content of stl in this thing :)). Never knew about such stl container. – Ben Usman Mar 19 '10 at 20:18