Chapter 16. Performance
Introduction
Performance has been a concern of ours throughout this book, and we have endeavored to provide you production-ready code that will perform well in any setting. And when a recipe involves trade-offs between performance and ease of implementation, we strive to bring these to your attention. Nevertheless, when an application is not performing as well as you would like, you can often improve matters by altering its handling of the following elements:
-
ViewState You can often improve a page’s performance by disabling the
ViewStatefor the page or some of its controls, but you have to be aware of the consequences.- String manipulation
You’ve probably heard that it is better to use the
StringBuilderobject to build strings rather than the classic concatenation operators (&and+). But you may be wondering just how much better and whether it really applies to your situation.- Data access
With the different options available for data access, it’s little wonder that there are ways to improve data access performance, especially when choosing between the two primary methods for reading data from a database—i.e., via a
DataReaderor aDataAdapter.- SQL Server managed provider
For the sake of database interoperability, the bulk of the recipes in this book show how to access data using the
OleDBmanaged provider. Yet because of the performance that can be garnered, there is much to be said for using the SQL Server managed provider instead when you know the application ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access