If I add compiler optimisation flags to my application should I also rebuild my toolkit with the same flags?
To optimise my application I am testing different compiler (VS2008) options in my qmake project file.
QMAKE_CXXFLAGS += /MP /Ox /arch:SSE2 /GL
However it occurs to me that whilst I get the optimised binary for my application, the Qt DLL's which it depends on are not optimised in the same way.
Should I recompile my Qt toolkit to get the same benefits? And if so should all developmen开发者_如何转开发t projects look to optimise all dependency's?
I don't think recompiling Qt makes sense here. Normally, the (release mode) DLLs will be compiled with sufficient optimisation for most uses. Normally Qt is used for the GUI, and if your application has performance issues because the Qt code isn't fast enough, there will be other reasons for that. Concentrate on finding these instead of wasting your time trying to optimise code that's only responsible for 1% of your applications runtime (of course 1% is just a guess here, use a profiler to find out if you really want to know).
Sometimes libraries come in two flavors: a prodution DLL and one for debugging. You should just make sure, taht when building in release mode, the appropriate DLL gets linked.
精彩评论