Asp.net Performance Optimization

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.