Chapter 11. Common Performance Issues

I l @ ve RuBoard

In the previous chapter, I discussed methodologies for finding functional issues with your applications. In this chapter, we'll look at the some of the most common and significant causes of performance problems. Resolving performance issues in any application is not an easy task. You can think of this chapter as a "cheat sheet" for the most common issues.

I'll cover a wide variety of topics, but this chapter will by no means be comprehensive. There are, after all, a virtually infinite number of ways to shoot yourself in the foot . My focus will be on the most common issues that developers need to worry about. But I'll also discuss some issues that are good to be aware of just for the sake of good programming practice. Whether you're investigating performance or resource problems in an existing application or designing a new product, the material in this chapter should provide an essential reference.

In this chapter, you'll see a number of examples of compiled Microsoft intermediate language (MSIL) code because most of the performance problems I'll discuss are the result of bad programming practices or mistaken assumptions. Microsoft Visual Basic has always had a reputation for making development easier, but of course this often means that the compiler inserts a lot of code under the covers to implement those language features. I'll try to show you the implications of those features so you'll know what to avoid and so you can have another tool for analyzing your code.

Note

You don't have to understand MSIL in order to understand this chapter. I'll try to explain as much as necessary for the examples provided, and the material can serve as a starting point for your own investigations. However, it's important that you have at least a basic understanding of what the Visual Basic .NET compiler produces. This can help you to make better decisions.


Visual Basic .NET Performance vs. Visual C# .NET Performance

A lot of people have had questions about the performance of Visual Basic .NET versus that of Microsoft Visual C# .NET. Their concern has had mostly to do with Visual Basic's former reputation as slow and inefficient (at least compared to Visual C++). Because C# is based on the C++ syntax, the assumption has been carried over into the .NET world that, all things being equal, C# is faster than Visual Basic.

This is not the case. You can always prove it to yourself with your own tests, but directly equivalent code will perform the same and the compilers will generate nearly identical MSIL. You can run into problems, however, when you use some of the convenient but inefficient features of Visual Basic .NET (or any of the backward-compatibility features). But the performance of the language you develop with ultimately has comparatively little to do with the performance of your application. The greatest impact on performance comes from choices that individual developers make that are unrelated to the specific development language. Bad decisions or wrong assumptions will quickly sink any ship. Don't blame the language.

I l @ ve RuBoard


Designing Enterprise Applications with Microsoft Visual Basic .NET
Designing Enterprise Applications with Microsoft Visual Basic .NET (Pro-Developer)
ISBN: 073561721X
EAN: 2147483647
Year: 2002
Pages: 103

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net