Asp.net Ajax Performance Optimization Test
Asp.net Ajax improves performance (also applies to the Web ):
- Composite-reduces the number of requests
- Compression-Reduce request data
- Cache-improves the efficiency of Request Response
Therefore, in the optimization process, you can merge and compress the files that can be compressed, and cache the files as much as possible.
The following uses an example to illustrate how to optimize an Asp.net page so that it runs best. Of course, this is only a very low-level approach, but it is easy and practical. Suitable for beginners.
The following is a page for this test.
Four controls and several ajaxcontroltoolkit pages are used.CodeAs follows:
For the first time, the worst was not optimized.
A total of 23 requests were not cached. It took 1.4 seconds to send 16.74kb to receive 0.96m data.
This is a very bad page. Even if you refresh the page for the second time, JavaScript will not be cached.
For the second time, let's take a look at the two parameters to see the best results.
A total of 23 requests, all scripts are cached and compressed, and 17.70 KB is sent to receive 0.51 data, which takes seconds. This test is much better than the first one, 98% less data is returned from the server, which is very effective;
The third time we need to merge the Javascript of these multiple requests into one request, which can bring better results, here we need to download a scriptreferenceprofiler; http://aspnet.codeplex.com/releases/view/13356 and then drag it to your page, it will display the JavaScript-
The following is the JavaScript code
Scriptmode = "release", enablepartialrendering = "false"
The scripts provided by ajaxtoolkit are divided into debug and release. The release script removes the less characters
The test results are as follows:
A total of 9 requests, all scripts are cached and compressed and merged. It took 0.219 seconds to send 6.6kb to receive 8.21kb data. This test and the first illegal comparison were conducted;
The above tests hope to help you and hope you can see better optimization solutions.