![]() Set Goals It's a trivial concept, but sometimes people forget that, in order to decide if an application is fast or slow, you need to have goals to measure against. If you apply these simple recommendations, your code will perform well by design. Next time, before you start writing code, spend some time thinking about the scenarios in which the code will run, and identify which are the metrics and what are the factors that will impact performance. These examples should illustrate that performance is very context-dependent, and playing out scenarios can help you to tease out important variables. Two metrics that you can use in this scenario are CPU cost per iteration and allocations per iteration. For example, if the algorithm touches large regions of memory, it is likely that L2 cache misses will prevent your algorithm from running at the fastest speed. To optimize, you need to focus on the algorithms and minimize the cost per instruction. Refactoring your code by removing some dependencies or by delay-loading modules (which I'll cover later) could result in big performance improvements.įor code that is called repeatedly (such as a hash or parse function), speed is key. The reason is that most of the startup time will be spent loading DLLs or reading configuration files.įor startup scenarios you should analyze how many modules are loaded and how your app is going to access configuration data (files on disk, the registry, and so on). If you don't take into account that the component will be used at startup, you could spend time optimizing code paths without seeing any significant improvement. From a performance point of view you want to minimize the use of external resources, such as network or disk, because they are likely to be a bottleneck. For instance, if you are designing a component that will be used at startup, it is likely that the component will be called only once (when the app starts). Think in Terms of Scenarios Scenarios can help you focus on what is really important. A good process can help you achieve the level of performance you need. Your success in reaching your performance goals depends on the process you will be using. So in this column, I'll present lessons we learned analyzing these applications. ![]() One recurring problem was client application startup time. Over the few past months, the CLR performance team met with several customers to investigate performance issues in some of their applications. But just because you're writing code fast doesn't mean you're writing fast code. Visual Studio is a wonderful development environment, whose IntelliSense®, integrated debugging, online help, and code snippets help boost your performance as a developer.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |