Performance Considerations

Perhaps the biggest problem with COM Interop is that it can be slow. There are approximately 50 instructions that get executed each time you cross the managed to unmanaged code boundary, and that does not include the time spent copying parameters from managed to unmanaged buffers. You should not, therefore, use COM Interop on chatty COM interfaces, that is, interfaces where you will have to make lots of method calls in order to use the interface. COM Interop is most useful for COM interfaces where method calls are not as frequent and where each method performs more functionality. For instance, if an object has four fields that make up its state, having a separate method to set the value in each field is a chatty interface. ...

Get .NET and COM Interoperability Handbook, The now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.