Shared_Ptr eates the performance of my application <p>I'm on Ubuntu, and I'm working on a computer vision application (optical flow), and I'm doing some profiling on the code using valgrind. After profiling, I found that the shared_ptr is taking 74% of the application. Kindly find the attached code that where the shared_ptr is used. I'm looking for an optimization for that. Besides that, also sprintf takes so much time, and the openMP threads also eats a lot. I'm really wondering about sprinft, and openMP cost...</p> <pre><code> int main(int argc, char *argv[]) { //QApplication a(argc, argv); omp_set_dynamic( 0 ); omp_set_num_threads( 4 ); double t1, t2; // ------------- Initialization: Frames. -------------- // Load first image char imFName[1024]; sprintf( imFName, "%s/img_%08i.png", imPath.c_str(), imIndex ); ifstream fileExists( imFName ); if (!fileExists) { printf("First image %s/img_%08i.png could not be loaded!", imPath.c_str(), imIndex); return -1; } QImagePtr prevImg; QImagePtr curImg( new QImage( QString(imFName) ) ); } </code></pre>