background preloader

Performance

Facebook Twitter

Memory leaks involving unmanaged resources Unmanaged memory is often leaked when you forget to write code to deallocate it; however this can also happen because references are retained to the managed object which is responsible for deallocating it. In other words, unmanaged memory can be held on to by managed memory; so even when it looks like you have an unmanaged problem, it can instead be a problem with your managed code. Code profilers like ANTS Memory Profiler can help demonstrate these kinds of leaks by showing you the chains of references holding unmanaged data in memory.

In the example below, the majority of the memory used by the instance of System.Drawing.Bitmap (in black) is unmanaged, so may appear as an unmanaged memory leak, but the Instance Retention Graph in ANTS Memory Profiler demonstrates that it is in fact held in memory by Mandelbrot.Form1, a managed object. String concatenation in a loop Resizing List<T> This can introduce memory problems, however. Unnecessary boxing. Performance Tips: Speed up Data Access. Practical .NET Performance Tips: Speed up Data Access The easiest way to check if data has changed is to incorporate the row's TimeStamp into the Where clause of the update statements you use in your ExecuteNonQuery methods (and, if you're really worried about volatility, during deletes).

If the TimeStamp has changed, the Where clause won't find the record and the UpdatedRows value returned by ExecuteNonQuery method will be zero. In that case, you apologize to the user, present the latest data, and let the user reenter their changes. If you're working with ASP.NET, the Cache object supports this process well.

Regardless of which tactic you follow, before retrieving any data from the database, you check to see if the data is already in the DataSet or collection. With caching, consider retrieving more data than the user asks for. Caching helps everyone: By reducing trips to the database server you also decrease the number of users accessing the engine at any one time. About the Author. Performance Tips: Speed up Data Access. Practical .NET Performance Tips: Speed up Data Access Faster performance in business applications comes down to reducing the "critical two" -- disk I/O and trips to the server. Doing that means doing a lot of things right, starting with your database design -- and tweaking your ADO.NET code helps, too.

I once cut the average response time for an application from more than four seconds to less than two. In another case, I reduced the runtime of a batch application from seven hours to 45 minutes. In a third case, I eliminated a problem that caused an application to run slower and slower as the day went on until, finally, it would crash at about 2 p.m. Data access slows business applications down. If you're reading this article for some ADO.NET programming tips, you're going to be disappointed (though, by the end of this article, I'll be talking about what you can do in ADO.NET). Speeding up database access comes down to what happens as you read sectors from a disk drive. Fast and Less Fast Loops in C# Download Cache Test - 92.15 KB Introduction After I did the first article on QS, I decided to use the tool to do a few experiments to investigate how the CPU cache affects performance. During these experiments, I got a few insights with regard to the performance of various C# constructs that I will share with you here.

Background The memory system of your PC most likely consists of a large but slow main memory and smaller but faster CPU caches for instructions, data and virtual memory management. When a memory address is accessed, the CPU sends its request to the closest cache (L1) and if the cache holds the value for the address, it simply responds with the value. So what happens if the L1 cache does not contain the data we are looking for? If you want to learn more about caches work, see the article on Wikipedia or check out the document “What Every Programmer Should Know About Memory” at. Performance - Difference between foreach and for loops over an IEnumerable class in C#

Use DNS benchmarking tools to optimize performance | Network Administrator | TechRepublic.com. Managing, Tuning, and Configuring Application Pools in IIS 7.0. The Microsoft Engineering Operations (MSCOM Ops) team uses both integrated and classic requestprocessing to manage application pools in Internet Information Services (IIS) 7.0 to optimize performance and improve site availability at www.microsoft.com. In this article, we discuss how we leverage the benefits of the integrated requestprocessing mode, describe the configuration settings that we use to tune application pools, and explain which configuration changes result in application pool recycling.

We also provide examples that demonstrate how you can configure application pools by using the appcmd.exe command line tool and IIS Manager. Microsoft® Windows Server™ 2003 and IIS 6.0 introduced the ability for Web administrators to create custom application pools in addition to the default application pool for Web sites.

Each application pool functions as a separate process in its own isolated allocation of virtual memory address space. Benefits of Classic Mode · Backward compatibility. 1.