Performance of passing data between .Net and COM assemblies
Asked Answered
O

1

3

I am in the process of migrating a legacy VB6 app to .Net, however since it is a high-profile business critical application, it is being done piece by piece.

In the interest of improving performance, there is one method which gets hit a lot,thousands of times during the application life, and I was wanting to rewrite it in .Net (C#) to see if the runtime can be improved.

The method in question manipulates ADODB Recordsets. Is there any performance issues I should be aware of or take into consideration since these recordsets will be passed to and from VB6 via COM interop?

Odette answered 22/2, 2010 at 7:18 Comment(0)
E
2

I haven't done anything specific on this but from my experience with Interop, .NET is very well optimized and usually per interop call to Win API or COM only introduces nano seconds of overhead that is negligible. ADO Recordset will just be treated the same as any other COM objects created on unmanaged heap and under the hood is the IntPtr address that they deal with.

Native .NET framework library and its garbage collector is far superior than whats avaialble in VB. I believe rewriting some of your old VB code in .NET may give you some performance gain more or at least enough to ignore the interop overhead. Best if you equip yourself with a profiler tool and continuosly monitor performance as you migrate the implementation piece by piece.

Erysipelas answered 22/2, 2010 at 10:40 Comment(2)
+1 For the first paragraph about speed of interop. I am rather skeptical about any general performance gain to be obtained by rewriting VB6 components in .NET. There might be specific performance gains in some specific situations.Resilience
The overhead is significant enough that Microsoft has written several articles about optimization techniques. msdn.microsoft.com/en-us/library/ms998551.aspxCoition

© 2022 - 2024 — McMap. All rights reserved.