Performance optimization: In short, without affecting the correctness of the operation of the system, make it run faster, to complete a specific function of the time required less
http: Hypertext protocol
Its top layer is the application Layer Transport Layer Network layer physical layer
Request information: Request line request header blank line message body
Response Information: status line and Status code
Use the ToString method of a value type:
When connecting strings, you often add numbers directly to the string using the "+" number. Although this method is simple, it can get the correct result, but because it involves different data types, the number needs to be converted into a reference type by boxing operation to be added to the string. However, boxing operations have a greater impact on performance because, when such processing is done, a new object is allocated in the managed heap, and the original value is copied to the newly created object. Use the ToString method of value types to avoid boxing operations, thereby improving application performance.
Try to select HTML controls:
The functionality that can be implemented on the client side is implemented on the client side (mastering JavaScript) to reduce server pressure. Data Control Selection Order: Repeater, DataList, DataGrid.
When the database connection is established, the connection is turned on only when the operation is really needed, and is closed immediately after use, so as to minimize the time that the database connection is opened and to avoid a situation exceeding the connection limit.
String Manipulation Performance optimization
(1) Use the ToString method of the value type.
When connecting strings, you often add numbers directly to the string using the "+" number. Although this method is simple, it can get the correct result, but because it involves different data types, the numbers need to be boxed and converted into reference types to be added to the string. However, boxing operations have a greater impact on performance because, when such processing is done, a new object is allocated in the managed heap, and the original value is copied to the newly created object. Use the ToString method of value types to avoid boxing operations, thereby improving application performance.
(2) Using StringBuilder class
The string class object is immutable, and the method ToString does not significantly improve performance for a string object that is essentially recreating a string object and assigning the new value to the object. When working with strings, it is best to use the StringBuilder class, whose. NET namespace is system.text. Instead of creating a new object, the class operates directly on the string through methods such as Append,remove,insert, and returns the result of the operation through the ToString method.
Avoid unnecessary round trips to the server
Use Page.IsPostBack to avoid unnecessary processing of round-trip processes.
Although you will most likely want to use the Time-saving and code-saving features of the Web Forms page framework as much as possible, in some cases it is not appropriate to use ASP.net server controls and postback event handling. Typically, you only need to start a roundtrip process to the server when you retrieve or store data. Most data operations can be performed on the client between these round-trip processes.
Compress JS
JS in the page to call the case to keep the same, lest the cache of different files, the page JS can be written in the unit file to invoke. Picture less JPEG, and use gzip to compress Web pages. Speed up the page display.
Call JS, try to write at the bottom of the page, there are viewstate state can also be rewritten to the lower part of the page, you can compress the viewstate. Conditions are viewstate necessary to use.