Question

I've taken an application that was developed in Visual Studio 2008 and used various Office libraries through COM Interop. I began some proof of concept development using the dynamic keyword and Visual Studio 2010. I found that performing the same tasks is around 5-10x slower using dynamic than the "old" way. Has anyone else experienced this level of performance degradation? Is this known or should I find a way to report this?

Was it helpful?

Solution

Yes, there is a known performance hit with the dynamic keyword. The reason for this is because it must box the values into the object type and then use the DLR (one-time) to compile it and evaluate it. This is going to take more time on the processor than if the type were known. You can see the accepted answer on this question for a more expanded description.

Finally, in your case, it would be even worse because it's already a COM object so boxing and unboxing that object on top of the COM overhead is going to be exaggerated.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top