How to increase perfomance of C++ code?