RE: [Dev-C++] Optimizing using the STL
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Abhijit S. <mu...@gm...> - 2003-07-25 14:26:26
|
Addendum: > > void pc_char::write_to_all_pc(string to_send, bool And another thing; wherever possible, pass by reference rather than by value. It's much more efficient for classes. For example, make write_to_all_pc: void pc_char::write_to_all_pc(const string &to_send, bool whatever) Note that the `const' also helps in optimization; gcc will know that the parameter is not modified, and make optimization arrangements based on this. This should actually give you more of a speed-boost than the previous thing I suggested. PS: As I mentioned, I am not an STL-wise person, so if the above optimization is insignificant because of the way the string class works, sorry. -- Abhijit Shylanath Homepage: http://mudeth.tripod.com/ |