|
Category |
Use Technology and Comparison |
Description |
|
Set Operations |
Array, generic, arraylist |
After testing, the fastest speed is the speed, then the generic type, and the slowest is the arraylist |
|
String Optimization |
String and stringbuilder |
After testing, stringbuilder is infinitely faster than string... |
|
Type conversion Optimization |
Use tryparse () for number extension Conversion () |
This method does not throw an exception. It takes a lot of time for the system to catch exceptions! |
|
Redirection Optimization |
Use server. Transfer in the same program |
However, this method may cause an exception when the user clicks the back button. |
|
---- |
Release objects as soon as possible |
Many objects implement the idispose interface, so call the dispose method to release it as soon as possible! |
|
Server Control Optimization |
Use as few server controls as possible |
The server control generates many unnecessary attributes, such as viewstate. |
|
Data Operation Optimization |
Open the database connection as soon as possible and close the connection as soon as possible. |
For example:
Connection. open ();
Command. executenonquery (XXX );
Connection. colse (); // close immediately after the statement is executed |
|
Use datareader to query read-only data |
Because datareader reads only one piece of data at a time and dataset reads data at a time, the performance of datareader is improved. |
|
Use stored procedures |
The stored procedure is pre-compiled with fast execution speed and high security. |
|
SQL statement Optimization |
Avoid unnecessary field queries (for example, select *). Select only useful fields (select ID) |
|
Reduce the use of subqueries. |
|
Frequently Used fields are indexed for query |
The benefit of indexing: http://www.cnblogs.com/zhuiyi/archive/2011/07/05/2097863.html |
|
Connection Pool Application |
Learning, to be added... |
Learning, to be added... |
|
Rational use of cache policies |
@ Outputcache command, system. Web. caching |
The former is page-level cache, and the latter can have a "quality" improvement. |
|
Web. config |
Change <compitation DEBUG = "true"> to false. |
The default debugging mode is used. |
|
Rational use of viewstate |
Enableviewstate = "false" to disable |
Reduce page size to reduce traffic |
|
Rational use of session Status |
Generally, you can use the default inproc. |
The session times out for 20 minutes. |
|
Use Ajax |
You can use ajax to perform partial refresh. |
Reduce traffic, just refresh the location that needs to be refreshed! |
|
Generate static pages |
Static Page technology through Io |
You can regularly generate static pages, and generate static pages in real time based on the website size and access volume. |