slow

1. Use DIV+CSS in website programs instead of Table

Currently DIV+CSS is the mainstream programming language, which is inseparable from its advantages of small size and fast loading. Mainstream websites and CMS also use this mode. Therefore, it is recommended that everyone also use this mode for programming, rather than the original Table structure. The Table structure is not only inconvenient to manage, but also increases the webpage size, reducing the website's loading speed.

2. Use Gzip technology to compress web pages

Using Gzip technology to compress web pages is a good way to reduce the size of web pages. Generally, this requires the support of your website hosting space. For example, on the A5 shared hosting I use, the compression rate can reach 80%. When the web page size is smaller, the loading speed naturally becomes faster.

3. Reduce the number and size of CSS files

In the process of using DIV+CSS, CSS files are very important. If there are multiple CSS files during development, it is recommended to merge them, which can speed up website loading. In addition, you can use professional webpage slimming software to slim down CSS files to reduce their size.

4. Use CDN to speed up

In the past year, CDN has become more common among individual webmasters, and many friends are using it. The full name of CDN is Content Delivery Network, which is interpreted as a content distribution network. The principle is to avoid as much as possible the bottlenecks and links on the Internet that may affect data transmission speed and stability, so that content is transmitted faster and more stably. It is a website accelerator. This requires payment; the free ones are not very stable.

5. Optimize code and reduce bloated structures

If we use the more popular CMS, there should not be bloated code structures. But it should be noted that unreasonable structures may also exist when we create or choose website templates. We need to use a relatively concise program framework when writing templates or programs. Conciseness is good for user experience and also more conducive to search engine spider crawling and indexing.

6. Reduce image size and quantity

We should try to reduce the size and dimensions of images when uploading them to the website. You can compress images before uploading; appropriate dimensions are enough, don't make them too large. Images are just decoration for the website, not everything needs to be image-text. At the same time, we should also avoid using large amounts of video or audio content.

7. Reduce JavaScript script files and try to keep them in one file

Try to call JS code externally, do not place it in the webpage, and do not remotely call external JS code. For example, Google recommends loading the analysis in the HEAD tag. You can also try combining JavaScript and compressing them to load faster. Sometimes we have too much CSS and JS code in the header, causing the middle content part to load too slowly. So try to reduce the code in the header.

8. Use static HTML pages

As we all know, ASP, PHP, JSP and other programs complete the static interaction of webpage information. They are indeed very convenient to run because of their good data interactivity, allowing convenient access and modification of database content. However, this type of program also has its own defects: it must first generate the HTML page on the server and then 'transmit' it to the user. This extra step will definitely affect the website's access speed. Therefore, the author suggests that during the initial stage of a new site, during the important observation period for your website, it is safer to use static HTML pages.

9. Change access to ASP, ASPX, PHP and other files to .js references

This should be noted when designing ASP, ASPX, PHP and other programs. If you want to embed dynamic data in a static HTML page, and the dynamic data is provided by ASP, PHP and other programs, you would use the following statement to reference it:

<script src="http://www.w3cschool.cc/network_index.php?data=1″></script>

In this case, each time someone visits your website, the server needs to execute and process the network_index.php file once, extract the relevant data from the database, and then output it to the webpage for display. If tens of thousands of people visit at the same time, it will be executed tens of thousands of times, and the consequences can be imagined. It is recommended to dynamically generate the data into a network_index.js file in these programs, and then in the homepage use

<script src="http://www.w3cschool.cc/network_index.js"></script>

such code to reference the network_index.js file. In this way, the task of data display is handed over to the client-side browser, which does not consume server resources, so the display speed is naturally very fast; the time spent by the former is almost several times that of the latter!

Article from:http://www.zuidaima.com/share/1962621598600192.htm