.netperformancetarget-framework

.NET Target Framework Performance


I have a .NET 4.0 class libary, which only uses .Net 2.0 features. To make this library more compatible with Mono, I'm considering changing the Target Framework to 2.0 instead of 4.0 Client Profile.

But the question is: Does changing the Target Framework to an older version, make the library run slower (hurt performance). The GUI of the application will still target 4.0, so all Windows PC's running the application will have the 4.0 framework installed. Will my 2.0 library be executed by the 4.0 JIT compiler (performance should be the same) or by the older 2.0 JIT (performance could be slower)?


Solution

  • No, as app still targets version 4 of the framework (as you said "GUI of the application will still target 4") then all the code will use the V4 jit and therefore run at the V4 speed even if a given dll target V2 of the framework.