English 中文(简体)
C++:最佳的文本累加器
原标题:C++: Best text accumulator

文字会在发送给客户端之前逐步积累。

现在我们使用自己的类,为每个字符分配内存作为字符阵列。 ( 无论如何,它的工作方式都是char[][] + std::list<char*>)。

然后,我们构建完整的字符串,将其转换为std :: sting,然后使用它创建 boost :: asio :: streambuf 。我认为这很慢。如果我错了,请纠正我。

我知道,在许多情况下,使用 stdio.h 中的简单 FILE 类型。 它是如何工作的? 在每次写入时分配内存。 因此,它是否更快且是否有任何方法可以从 FILE 读取到 boost :: asio :: streambuf 中?

添加:嗯,我忘记了一件大事:编译dll和主应用程序是在几个编译器下完成的,所以它不应该包含stl的任何内容……因为通常在执行dll时会引起很多问题。

最佳回答

我不知道它的效率有多高,但我通常用ostringstream进行这种类型的操作。

问题回答




相关问题
What to look for in performance analyzer in VS 2008

What to look for in performance analyzer in VS 2008 I am using VS Team system and got the performance wizard and reports going. What benchmarks/process do I use? There is a lot of stuff in the ...

SQL Table Size And Query Performance

We have a number of items coming in from a web service; each item containing an unknown number of properties. We are storing them in a database with the following Schema. Items - ItemID - ...

How to speed up Visual Studio 2008? Add more resources?

I m using Visual Studio 2008 (with the latest service pack) I also have ReSharper 4.5 installed. ReSharper Code analysis/ scan is turned off. OS: Windows 7 Enterprise Edition It takes me a long time ...

Manually implementing high performance algorithms in .NET

As a learning experience I recently tried implementing Quicksort with 3 way partitioning in C#. Apart from needing to add an extra range check on the left/right variables before the recursive call, ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...