String allocation/deallocation is a primary cause of heap fragmentation and poor performance.
There are three things that we can do to speed up string usage.
const SymString fname="my func";
should be .. static const SymChar fname=SymText("my func");
SymString will allocate memory for "my func" and copy it every time the function is entered.
SymString myString = "x";
if (myString == "x") do something;
should be .. if (ACE_OS::strcmp(myString, "x") == 0) do something;
SymString doesn't implement the operator== for a char *. Instead it will copy "x" into another SymString, do the compare and then free it.
const SymString & myGetFn() const
Always return a const reference in a Get fn. It is also a good idea to declare the Get fn as const.
On performance: socket programming
- Minimize packet transmit latency.
- Minimize system call overhead.
- Adjust TCP windows for the Bandwidth Delay Product.
- Dynamically tune the GNU/Linux TCP/IP stack.