Browse by Tags

All Tags » Performance (RSS)

Poor developer’s performance profiler

In the last post I wrote about a simple method that can help .NET developers micro measure the memory consumption of their application, in this post I want to show a way to measure application performance. Before I start I want to state here and now that there is no substitute to using an actual profiling application that will can find performance bottlenecks and problematic code, but if you have a small piece of code that needs profiling or you have a good idea where your problems lie then keep...
Posted by dhelper | with no comments

How does Stopwatch work

I’ve been using Stopwatch (and blogged about it ) for some time and it never occurred to me to check how it really works. When using it as a benchmarking tool the fact that perhaps it wasn’t as accurate as can possible be didn’t bother me at all. The question of the accuracy of Stopwatch become relevant in one of my pet projects, I needed a high precision timer and I wanted to know if it was up to the task. Investigating Stopwatch proved to be very easy – using Reflector and I’ve opened System.Diagnostics...
Posted by dhelper | with no comments

Performance optimization tip – understand your memory layout

.NET take care of all memory allocation and de-allocation and after a while it seems that programmers no longer need to understand exactly how data is stored in the memory. The idea of not needing to know how data is stored could not be farther from the truth, in fact memory layout have great impact on code performance. Test Case – For Loops Every program I ever wrote has at least one loop and often than not I use a For loop for iterating my collections. The following code accesses two dimensional...
Posted by dhelper | with no comments

Use measureIt to find out how much time it really takes

I've been interested in performance optimization from the first application I wrote and since than I been finding new ways to make my code run faster with less memory usage. Over the time I found that after discovering the existing bottlenecks in the code knowing which command takes more time to execute is always an easy win when in need of optimizing a specific code. There are several ways to find the performance implications of different code snippets - writing a benchmark, searching the Internet...
Posted by dhelper | with no comments

Three different ways to throw events in C#

The Event model in C# finds its roots in the event programming model that is popular in asynchronous programming. The basic foundation behind this programming model is the idea of "publisher and subscribers." In this model, you have publishers who will do some logic and publish an "event." Publishers will then send out their event only to subscribers who have subscribed to receive the specific event. In C#, any object can publish a set of events to which other applications can...

Performance Tuning in .NET using StopWatch

There comes a time in a software developer’s life where his code becomes slow. Sometime it is even possible to state the exact revision or date that caused the performance decrease. Searching the source code for the usual suspects can be futile and frustrating, and then there is the tricky part of making sure the performance issue has been solved after a change has been made. Don’t get me wrong – understanding code is a must, but there is much more to performance tuning then just reading the code...
Posted by dhelper | 3 comment(s)
תגים:, , ,

Why should I use List<T> and not ArrayList

I came upon a questing at StackOverflow : The system I work on here was written before .net 2.0 and didn't have the benefit of generics. It was eventually updated to 2.0, but none of the code was refactored due to time constraints. There are a number of places where the code uses ArraysLists etc. that store things as objects. From performance perspective, how important change the code to using generics? I know from a perfomance perspective, boxing and unboxing etc., it is inefficient, but how...