Please say three ways to reduce the load time of the page. (Load time refers to the perceived time or actual load time) __ FAQ

Source: Internet
Author: User

1. Reduce HTTP requests (merging files, merging pictures)

2, optimize the picture file, reduce its size, especially the thumbnail, be sure to generate thumbnails by size and then call, do not use the Resize method in the Web page to achieve, although the picture looks small, but its load of data is not reduced. I've seen a thumbnail loaded in a Web page with a real size of 10M. Ordinary image, Icon also want to compress as much as possible, can be used to save the web image, reduce the number of colors and so on to achieve.

3, the choice of image format (GIF: Provide less color, used in some of the color requirements are not high places)

4, compressed JavaScript, CSS code: General js, CSS files in a large number of spaces, line, comment, which is conducive to reading, if it can be compressed, will be very conducive to network transmission. This tool also has a lot, you can search in Baidu keyword "CSS code compression", or "JS code compression" will find that there are many sites provide such a function, of course, you can also write your own program to do this work, if you will. Take our website for example. Just began to upload this site, I have a lot of CSS code is not compressed, the following found this problem, I went online to find the relevant site of the compression code function, and finally put a lot of CSS files are compressed. This compression ratio is still relatively high, generally have a hundred 50 or so. This code compression is useful for Web page loading.

5, the server enables the GZIP compression function: Will transmit the file compression after the transmission to the client again decompression, in the network transmission data quantity will reduce greatly. Apache on the server, Nginx can be directly enabled, you can also use the code directly set the transmission file header, to increase the gzip settings, but also from the load balancing device directly set. However, it should be noted that this setting will slightly increase the burden on the server. Server performance is not very good site, to be considered carefully.

6. Indicate height and width (if the browser does not find these two parameters, it needs to download the picture side of the calculation size, if a lot of pictures, browsers need to constantly adjust the page.) This not only affects speed, it also affects the browsing experience. When the browser knows the height and width parameters, even if the picture is temporarily unable to display, the page will free up the picture, and then continue to load the later content. Thus the load time is fast, the browsing experience is also better. )

7, add "/" after the URL: to the server, without the slash server will be more than one time to judge the process, with a slash will be directly returned to the site settings in the site's root directory under the default page.


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.