Hi,
Our company is facing a crucial performance issue with component instantiation (using Component Model). We currently use .net 3.5 for most of our products and we cannot migrate to .net 4.0/4.5 because of that performance issue. The problem only occurs when
the component loads for the first time and in the following commonly used conditions:
- Optimization is enabled
- Component is in VB.NET
- Target framework is .net 4.0 or later
- Solution platform is x64
If the component contains a lot of subcomponents, the creation of the instance of the class takes several seconds. In our case, the class contains 300 child components and takes 53 seconds to be instantiated with the above conditions. If we change one of
the above conditions, the performance issue disappears. Moreover, we have noticed a huge memory and CPU usage during that time.
We have attached a sample project (VB.NET console application) with a basic UserControl with several sub components. The application creates 4 instances of the UserControl in a row and displays the elapsed time between each new instance. In regular cases, the
first instance takes 80/200ms to be created. However, with the above conditions, the first instance takes almost 4s to be created. That’s 50/20 times slower. Even with a basic configuration, we noticed that enabling optimizations increase load time by 5 (60ms
to 300ms).
From what we saw and analyzed, it seems to be a JIT compiler issue.
Download sample project: https://dl.dropboxusercontent.com/u/20096697/msdn_vb_new_component_issue.zip
Please note that the issue is not present while debugging the application within Visual Studio or using any profiler other than “sampling” mode.
We are currently running on Windows 7 x64 with .net 4.5 and Visual Studio 2012 installed.
Does anyone have any information about this behavior?
Thanks a lot.