How to optimize the performance of anthem. Net trial

Source: Internet
Author: User
Order:
Recently, I was eager to create an Asp.net Ajax test project, originally using Ajax. but later I found that Asp.net Ajax is easier to apply in Asp.net, so I decided to use Asp.net Ajax for development, and I can also learn about Asp.net Ajax, which is very popular recently. But the day before yesterday I read an article about anthem. net and Asp.net Ajax, and then try again. net, and find the things to be implemented in the original project. net can be achieved, and the ease of use is no worse than Asp.net Ajax, and the performance has been improved a lot. However, after experiencing the above advantages, we decided to switch to the original development project of anthem. net.

In the first part of the trial manual for using the anthem. NET development project, we will analyze and optimize the performance of anthem. net.

1. Performance analysis before optimization
Anthem. net core of 1.4cvs. the DLL file is 124 KB, compared to Microsoft. web. extensions. the size of DLL files over 600 KB is several times smaller, and the client script is only 22kb, which is much smaller than the client script of Asp.net Ajax with hundreds of kb. As you can see, fewer codes and script codes in the anthem. Net definitely mean better performance!

2. Optimization ideas
Anthem. net is indeed very small, but if you can further reduce the volume, it will undoubtedly make Ajax performance again improve, optimize the anthem. DLL does not seem necessary. net core has been written very concise, so the rest of the client script can be optimized, the answer is yes. Careful friends will find that Asp.net Ajax has a built-in webresourcecompression function, which is mainly used to compress client scripts, using this function can greatly reduce the size of client scripts loaded when the client browses the page, thus improving the page loading speed. However, in fact, you can add webresourcecompression to optimize performance like Asp.net Ajax. Let's take a look at the following implementation methods.

3. Implementation of Optimization
The default value is anthem. net does not have webresourcecompression. To add this function, you must first download the webresourcecompression function module, decompress it, And then decompress webresourcecompression. DLL is placed in Anthem. under the bin directory of the net project, and then in the web. add this sentence to config:

<Httpmodules>
<Add name = "webresourcecompression" type = "webresourcecompression. webresourcecompressionmodule"/>
</Httpmodules>

After webresourcecompression is added, we use the fiddler tool to compare the volume changes of the client loading anthem. js before and after webresourcecompression:

Before compression, the size is 22484 bytes.

The compressed size is 5921 bytes.

After webresourcecompression is used, JS scripts loaded on the client are reduced by about five times, from 22kb to about 5kb. That is to say, with the Ajax effect on your project, the client only needs to load 5 kb of data, which is equivalent to displaying a small GIF image! In addition, the script is loaded only when the page is browsed for the first time and then cached for a certain period of time. Of course, Asp.net Ajax also has this function, but after compression, the volume is also more than ten times larger than that of anthem. net, so that the first time that anthem. Net starts the page, the speed is undoubtedly much faster than the original!

Based on the above analysis and optimization, it is wise to use anthem. Net for projects that can achieve the desired Ajax effect!

PS: The webresourcecompression module is a simplified and extracted module from Asp.net Ajax. It has no compatibility problems with the original Asp.net and is not limited to anthem. net. If you like it, you can also apply the module to other ajax.net or common Asp.net pages to compress client scripts!

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.