Programmers on Yahoo! Developer Network said there are about 35 methods and techniques commonly used in the design for the site "is the" faster.
Programmers on Yahoo! Developer Network said there are about 35 methods and techniques commonly used in the design for the site "is the" faster. Basically, the "way" is classified into seven groups, including Content (content), Server (server), Cookie, CSS, Java Script, Image (photo), Mobile (Mobile), and the set website will be customized to exploit the fact that, in combination with other techniques that achieve the best results.
In this article, we take the same point by the method of group 9 and 21 Methods Content Left would be sent to you in the following period.
1) Limit the HTTP request
In fact, for any site or sites, upon receiving the request show about 80% of my time that users spend waiting for the data transfer between the server service (or clear rather than storage sites) to the browser. While most of the time "died" this being "tied" to download all the components in a web page as image formats (stylesheet), the script code (script), content Flash, . . . to browse the site can be reconstructed on the screen (computer or mobile device) by the user. Therefore, reducing the number of component contents of this form means reducing the amount of HTTP requests (HTTP request) from browser.
One way to reduce the number of components in a page is trying to do simple design of the site. However, the question that many Web designers often posed is "no way to build a site with rich content while ensuring speed of response / display fast or not?". There are several techniques to help reduce the number of HTTP requests, but still support a rich web page design, such as:
"Include" files (Combined files) are fundamental solutions to reduce the number of HTTP requests, by linking all the scripts available on site on a single script file, and the like is to combine all CSS stylesheet to a file. The files are joined together making it more difficult for programmers (and even more websites) for stylesheet and script varies in each site.
Meanwhile, the CSS sprites is a method many programmers like to use to reduce the number of HTTP requests, by reducing the time required to access images. Specifically, programmers and web designers need to match the wallpaper on a single image and then use the programming tools (such as CSS background-image and background-position) to request the images appear correctly necessary.
Similarly, the method also Image maps combine multiple images into a single image. With this method, content capacity to display images will not change (by using the sum of the component image files before), but method contributed rice makes reducing the number of HTTP requests to minimum, thereby also helping to meet site much faster. Note method of image maps can only be applied when the images appeared side by side on the site.
In addition, Inline Image method, using the syntax data: URL to embed data in the image on the site and of course this will increase the size of HTML files. However, combining the images embedded in the stylesheet (by caching) is how to reduce the number of HTTP requests, while avoiding the phenomenon of increasing the capacity of the site. Unfortunately, this method is not supported on all popular browsers.
In general, reduce the number of HTTP request method should first think of when you want to show speed improvements as well as response time of the site.
2) Reduce DNS queries
Basically, the system of domain name resolution (Domain Name System) is responsible for "mapping" name server (or website) with the IP address, like a phone book. Typically, from 20 to 120 milliseconds for DNS to find the IP address of a maychu name (hostname) and the browser will not download anything from any content hostname until the DNS service search is completed.
The DNS lookup is usually saved to browse faster. This information can be stored on a dedicated server of the ISP or local network server, but sometimes can be saved on the computer user's personal. About DNS in particular memory area of the OS (such as "DNS Client service" on Microsoft Windows). Most browsers have their own storage area, independent of OS memory area DNS. When the browser also saved DNS information, it will not bother to conduct queries OS.
By default, Internet Explorer saved DNS information within 30 minutes, as determined by DnsCachTimeOut parameters in the Registry, while Firefox only store this information within a minute, is controlled by configuration parameters network. dnsCacheExpiration .
When the DNS memory space (for both browser and OS), the number of DNS queries with the correct hostname amount mentioned in the website. These included the hostname used in URL addresses, pictures as well as the script file, stylesheet, website Flash object. Reduce the number of host names synonymous with reducing the number of DNS queries.
However, reducing the number of host names (not identical) risk reduction in the number of parallel tasks download takes place within the site. Avoid manipulating DNS queries will reduce response time, but reduce the number of parallel downloads may increase this time. Many programmers remedy this situation by dividing the subjects mentioned above at least two but not more than 4 hostname - this is the best arrangement to reduce the number of DNS queries and download capability allows parallel high.
3) Save for Ajax advance
You need to understand that "asynchronous" (asynchronous) does not mean "immediate. "
To improve the speed of the site, it is important to optimize these Ajax responses. The most important way to improve the performance of Ajax is to make the response is stored temporarily in memory (depending on the browser or computer design's intention. ) With this method, users should note the duration of the stored value.
4) Use the downloaded component after loading site
5) Use of components are downloaded before the site loaded
Many users are often difficult to distinguish that difference between the methods used components are downloaded after load web page and use the components to be downloaded before the site loaded, but actual results from two very different approaches. Previous by downloading components, you can take the time to wait by the browser and downloading the required components (such as images, stylesheet, script, . . . ) going to use. With this approach, when users visit the site next, do you have on hand almost all the components in the memory and of course the site will appear quicker.
The first download content often divided into types: no need to download the previous conditions, and predicted conditions - depends on the intent of web design.
6) Reduce the number of DOM objects
A large number of DOM objects can be warning signs you need to improve the website's HTML code that is not necessary to remove or reduce the content. You're using multiple tables are stacked for display purposes, or to use as many tags <div> only to overcome the problems related to the show?
You can use the YUI CSS tools (hxxp: developer. yahoo. com/yui/), as well grids. css to control the design (layout), or have font. css and reset. css can help you bypass the default format of the browser. This is your opportunity to renew and make a difference for his site in the stage show.
Programmers often wonder how much is too much DOM object? For example, the homepage of Yahoo! a site is quite dense, but only less than 700 objects. You could easily identify the number of utility objects with Firebug DOM (hxxp: getfirebug. com/). In the console window, type the command document. getElementsByTagName ('*'). length.
7) Put on multiple domains
The distribution of components in a web page will allow you maximum download tasks in parallel. Make sure you are using the domain 2-4 as this is related to DNS queries. For example, you can set the (host) and HTML content in www. example. org address and then distributed to the two static components as static1. example. org and static2. example. org other domains. You can see more information about this solution at hxxp: yuiblog. com/blog/2007/04/11/performance-research-part-4/.
Minimum number iFrame
Basically, the iframe that allows an HTML document is inserted into the original document (or "father material. ) You should understand how to use iframes work most effectively. Advantages of the iframe:
* Support for slow content of third party, such as banner ads or pictures, etc.
* Allow scripts, or additional security tools
* Support to download the scripts in parallel
Disadvantages of the iframe:
* Course web page while downloading
* No visual language
9) Do not use the message "404"
As stated above, the HTTP request will definitely not necessary slow response of the site, not only that, after receiving feedback from a useless HTTP request (as reported 404 Not Found) , the user will feel uncomfortable.
Some websites have the initiative to create more compelling message 404, such as "404: Did you mean X?", So that users feel more comfortable in front of a malfunction. But this will waste the resources of the server.