教你50招提升ASP.NET性能(十三):精选技巧集合

时间:2023-03-08 21:09:25
教你50招提升ASP.NET性能(十三):精选技巧集合

(19)A selection of tips

招数19:

精选技巧集合

Including height and width in <img /> tags will allow your page to render more quickly, because space can be allocated for the image before it is downloaded.
在<img />标签中包括height和width属性会加速你的页面呈现,因为下载完成之前空间可以分配给图像。

(20)Add script references at the bottom of the page, because asynchronous downloads halt when a script reference is reached. Style sheets and images can be downloaded

asynchronously.

招数20:

在页面底部添加脚本引用,因为当脚本引用到达时异步下载中断。样式表和图像是能够异步下载。

(21)Use a content delivery network (CDN) for hosting images and scripts. They may be cached and it will reduce load on your server.

招数21:

使用内容分发网络(CDN)托管图像和脚本。它可能会被缓存从而减少你服务器的负载。

(22)Use image sprites to retrieve smaller images in one download.

招数22:

使用图像精灵通过一次下载获取小的图像。

(23)Use AJAX to retrieve components asynchronously that may not be needed immediately, such as the content of a collapsed panel, content behind a tab, and so on.

招数23:

使用AJAX异步获取可能不需要立即加载的组件,比如伸缩面板的内容,TAB页后面的内容,等等。

(24)Make sure you’ve removed HTTP modules that aren’t being used (Windows authentication, for example), and that you’ve disabled services such as FTP and SMTP, if

you’re not using them.

招数24:

如果你不使用它,确保你已经移除了不使用的HTTP模块(比如,Windows认证),和禁用了FTP和SMTP服务。