Freigeben über


.NET Framework Usage Performance Rules

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

Performance rules in the.NET Framework Usage category identify specific methods that can be optimized and also identify more general usage patterns, such as garbage collection and lock contention, that can be investigated for performance issues.

Rule Description
DA0001: Use StringBuilder for concatenations Calls to System.String.Concat(String, String) are a significant proportion of the profiling data. Consider using the StringBuilder class to construct strings from multiple segments.
DA0005: Frequent GC2 collections A relatively high number of .NET memory objects are being reclaimed in generation 2 garbage collection. If too many short-lived objects survive generation 1 collection, the cost of memory management can easily become excessive.
DA0006: Override Equals() for value types Calls to the Equals method or the equality operators of a public value type are a significant proportion of the profiling data. Consider implementing a more efficient method.
DA0007: Avoid using exceptions for control flow A high rate of .NET Framework exception handlers were called in the profiling data. Consider using other control flow logic to reduce the number of exceptions that are thrown.
DA0010: Expensive GetHashCode Calls to the GetHashCode method of the type are a significant proportion of the profiling data or the GetHashCode method allocates memory. Reduce the complexity of the method.
DA0011: Expensive CompareTo The CompareTo method of the type is expensive or the method allocates memory. Reduce the complexity of the CompareTo method.
DA0012: Significant amount of Reflection Calls to the System.Reflection methods such as InvokeMember and GetMember or to Type methods such as InvokeMember are a significant proportion of the profiling data. When possible, consider replacing these methods with early binding to the methods of dependent assemblies.
DA0013: High usage of String.Split or String.Substring Calls to the System.String.Split or Substring methods are a significant portion of the profiling data. Consider using IndexOf or IndexOfAny if you are testing for the existence of a substring in a string.
DA0018: 32-bit Application running at process managed memory limits System data that is collected during the profiling run indicates the .NET Framework memory heaps approached the maximum size that the managed heaps can reach in a 32-bit process. Consider profiling again using the .NET memory profiling method and optimizing the use of managed resources by the application.
DA0021: High rate of Gen 1 garbage collections A relatively high number of .NET memory objects are being reclaimed in generation 1 garbage collection. If too many short-lived objects survive generation 0 collection, the cost of memory management can easily become excessive.
DA0022: High rate of Gen 2 garbage collections A high number of .NET memory objects are being reclaimed in generation 2 garbage collection. If too many short-lived objects survive generation 1 collection, the cost of memory management can easily become excessive. This rule fires when the rate of lock contentions exceeds the upper threshold value of rule DA0005.
DA0023: High GC CPU time System performance data that is collected during profiling indicates that the amount of time that is spent in garbage collection is significant compared with the total application processing time.
DA0024: Excessive GC CPU Time System performance data that is collected during profiling indicates that the amount of time that is spent in garbage collection is excessively high compared with the total application processing time. This rule fires when the amount of time spent in garbage collection exceeds the upper threshold value of rule DA0023.
DA0038: High Rate of Lock contentions System performance data that is collected with the profiling data indicates that a significantly high rate of lock contentions occurred during application execution. Consider profiling again using the concurrency profiling method to find the cause of the contentions.
DA0039: Very High Rate of Lock contentions System performance data that is collected with the profiling data indicates that an excessively high rate of lock contentions occurred during application execution. Consider profiling again using the concurrency profiling method to find the cause of the contentions. This rule fires when the rate of lock contentions exceeds the upper threshold value of rule DA0038.