where developers meet development
Monday,November 18,2019


Writing High Performance .NET Code

Improving ADO.NET Performance

a. Use stored procedures – easy for maintenance and for improving SQL performance

b. Analyze and use data reader and data set appropriately (1). Consider using data readers if:

  b.a. You don’t need to cache the data or data is read-only
  b.b. When you want to fetch many records rapidly
  b.c. If you don’t have to chose random records

c. Use try{} and finally{} to make sure the connections are closed: If an exception occurs and you have written close at the end, try block or in catch block; it might not execute and keep these connections open

d. Get only the data that you need from the database: To minimize the time

e. Use appropriate type of transaction (SQL, ADO.NET and ASP.NET level) and minimize the transaction duration

f. Use paging mechanism if you want to get large data sets from database for better user experience and to reduce the time

Till now, we have seen tips, tricks and BKM’s for writing high performance .NET code. What follows is a brief list of performance tools that are available for tuning .NET code. This paper will not detail them.

  • Perfmon – System level tool. It exposes several CLR, ASP.NET related counters and this should be used as the first tool for analyzing any .Net applications. I will go in to detail on the counters available and some tips in later posts.
  • Intel® Vtune™ Analyzer: Profiling tool from Intel which supports .NET including ASP.Net applications.
  • CLR Profiler: Tool from Microsoft which is used to profile memory (allocation) of your application. It is free and downloadable from msdn.
  • SOS: Manage debugging extensions from Microsoft. Free, Shipped as SOS.dll with CLR. Exposes many CLR internal data structures such as GC, Exceptions, Objects, Locking etc. Can be used to identify functionality bugs (such as OutOfMemoryException) and performance related bugs as well (locking etc).
  • VSTS Profiler: A built in profiler from Microsoft® Visual Studio Team system 2008. Can sample application and identify hotspots and hot call chains etc
  • VSTS: The Microsoft® Visual Studio Team system (for testers) has a built in ability to do performance load testing of n-tier web based applications. It is very simple to use including a recording facility for URL’s and also has ability to look @ perfmon counters of all the machines from a client system etc.

In this new Internet era application performance is essential to be successful and to stay ahead of the competition. Including performance engineering throughout the SDLC (software development life cycle) is essential to achieve/exceed performance goals. Performance engineering should be proactive and not reactive (example: When customer complains of a problem). This paper outlines information, tips and BKM’s for improving performance and looking at potential issues in threading etc if you are developing your application using Microsoft® Framework SDK.


  1. Author's Blog
  2. Multi-core community on Intel Software Network
Milind Hanchinmani is currently a Senior Application Engineer with 13 years of industry experience with over 7+ years @ Intel. He joined APAC enabling team last year and has been working with Enterprise ISV’s and SI’s to improve their application performance on Intel® Architecture. At Intel, in his previous role for 6 years Milind worked as a member of the Intel on-site team at Microsoft in driving improvements in the quality and performance of three generations of Microsoft® .NET Framework for Intel Architecture. His expertise includes performance methodologies, benchmarking and .NET CLR internals.

Register to DeveloperMarch

Be part of DeveloperMarch and get updates on upcoming events. Youcan register with the form below:

Job Title*
Phone Number*
Confirm Password*
E-mail address:*
Your Details:
Your name: *
E-mail address: *
Software Supportby Advanced Millennium Technologies

Advanced Millennium Technologies. Expertise in software development, offering consultancy services, Open source programming, CRM - Customer Relationship Management, CMS - Content Management System , ERP - Enterprise Resource Planning and Ecommerce development, AJAX, PHP, .NET, J2EE, SOA, XSLT, DOJO toolkit development and software testing. A robust onsite-offshore model. A well-defined global delivery model. AMT Outsourcing center. www.amt.inTAROBY - The E-Mail Dashboard for EntrepreneursTaroby is a SaaS based messaging and collaboration suite inbox that enables sharing of email accounts among team members. The unique concept of 'Team Inbox' makes Taroby an excellent enterprise collaboration suite for enterprises. Taroby is an effective tool for CEO's and entrepreneurs to manage multiple departments or manage multiple projects under them. The team inbox gives the entrepreneurs an overview of what is happening their business and give a quick snap shot of the employees who is responcible for handling the tasks/emails. For team members taroby brings in transparency and efficiency in their teams. Taroby improves the internal and external communication in an organization. Using the Taroby's Team Inbox also helps in reducing the usage of disc space and there by helping the enterprises to reduce carbon footprints.