Checklist: Interop Performance
Retired Content |
---|
This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
Improving .NET Application Performance and Scalability
J.D. Meier, Srinath Vasireddy, Ashish Babbar, and Alex Mackman
Microsoft Corporation
May 2004
Related Links
Home Page for Improving .NET Application Performance and Scalability
Send feedback to Scale@microsoft.com
How to Use This Checklist
This checklist is a companion to Chapter 7, "Improving Interop Performance"
Design Considerations
Check | Description |
---|---|
Design chunky interfaces to avoid round trips. | |
Reduce round trips with a facade. | |
Implement IDisposable if you hold unmanaged resources across client calls. | |
Reduce or avoid the use of late binding and reflection. |
Marshaling
Check | Description |
---|---|
Explicitly name the target method you call. | |
Use blittable types where possible. | |
Avoid Unicode to ANSI conversions where possible. | |
Use IntPtr for manual marshaling. | |
Use [in] and [out] to avoid unnecessary marshaling. | |
Avoid aggressive pinning of short-lived objects. |
Marshal.ReleaseCOMObject
Check | Description |
---|---|
Consider calling ReleaseComObject in server applications. | |
Do not force garbage collections with GC.Collect. |
Code Access Security (CAS)
Check | Description |
---|---|
Consider using SuppressUnmanagedCode for performance-critical, trusted scenarios. | |
Consider using TLBIMP /unsafe for performance-critical, trusted scenarios. |
Threading
Check | Description |
---|---|
Reduce or avoid cross-apartment calls. | |
Use ASPCOMPAT when you call single-threaded apartment (STA) objects from ASP.NET. | |
Use MTAThread when you call free-threaded objects. | |
Avoid thread switches by using Neutral apartment COM components. |
Monitoring Interop Performance
Check | Description |
---|---|
Use performance counters for P/Invoke and COM interop. | |
Use CLR Spy to identify interop problems. |
Retired Content |
---|
This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |