Test Your Code's Performance Using FxCop (Microsoft Platform)

This only applies to Microsoft Visual Studio development environment.

Download FxCop version 1.36.

Install it and create a project and then point to your assembly or exe files. Let it run it you will get reports like these.









This is good for programmers who wanted to know what are the benchmarks for performance and design. You can also find out a lot about coding standards and best practices by having a run on FxCop for your assemblies and exes.

For instance.. The followings are design rules and performances rules dictated as standards from FxCop.

Design Rules
  • Abstract types should not have constructors
  • Assemblies should have valid strong names
  • Avoid empty interfaces
  • Avoid excessive parameters on generic types
  • Avoid namespaces with few types
  • Avoid out parameters
  • Collections should implement generic interface
  • Consider passing base types as parameters
  • Declare event handlers correctly
  • Declare types in namespaces
  • Default parameters should not be used
  • Defnite accessors for attribute arguments
  • Do not catch general exception types
  • Do not declare protected members in sealed types
  • Do not declare static members on generic types
  • Do not declare virtual members in sealed types
  • Do not declare visible instance fields
  • Do not expose generic lists
  • Do not hide base class methods
Performance Rules
  • Avoid excessive locals
  • Avoid uncalled private code
  • Avoid uninstantiated internal classes
  • Avoid unnecessary string creation
  • Avoid unsealed attributes
  • Avoid unused private fields
  • Dispose methods should cal SuppressFinalize
  • Do not call properties that clone values in loops
  • Do not cast unnecessarily
  • Do not concatenate strings inside loops
  • Do not initialize unnecessarily
  • Initialize reference type static fields inline
  • Mark members as static
  • Override equals and operator equals on value types
  • Prefer jagged arrays over multidimensional
  • Properties should not return arrays.
  • Remove empty finalizers
  • Remove unused locals
  • Test for empty strings using string length
  • Use literals where appropriate

Comments