How to reduce the memory and CPU footprint of a Web page

Source: Internet
Author: User
Tags file size header resource save file

Some pages do not look small but open will be very card, and some pages, although very long but the use of fluent, the user's computer memory and CPU affect these.

Browser problems, have their own browser to deal with memory problems will affect, but almost no way to control, windows on:

    • IE series, the amount of refresh recovery is small, but the minimization will release memory.
    • Firefox2 is also said to be in the minimization of recycling, but I have never seen the most rubbish, how much is how much, basically do not recycle. It is said that prototype Ajax also causes memory to increase.
    • Opera is best. have been very well controlled. There is no problem.

Linux's memory allocation mechanism is not the same as Win's, how much use, if the browser can take out the system when the light.

Page problems, browser rendering page will consume memory and CPU, can reduce a little bit less.

Structure on

    • Using DOCTYPE, tell the browser what you are using, and HTML4 also have a DTD. Maybe transitional is better for you.
    • If you are using XHTML and can maintain a good structure, remember to output the corresponding MIME and XML header 1, you can reduce the browser's code check,
    • Keep the structure intact, don't let the browser help you complete the code.
    • Control the file size of the page, you can use the program to see the code more comfortable indentation removed. 2~3K is also size.
    • IFRAME will produce new pages, in fact there are many ways to replace the IFRAME
    • The introduction of JS and CSS can be properly merged, the same background image can also be merged, and even Flash are merged
    • You can reduce local/object of a page by adding a width attribute to a known-wide content picture

Performance on

    • The quality of 99 and 70 jpg In most cases only file size is not the same. GIF is the same, especially small icons, 256 color and 128 color difference is the file size.
    • Flash move too fast to eat the CPU is very large, control the number of frames per second and animation effect can be reduced, if the quality of the low display will save a lot of resources, but this has sacrificed the effect. Quality attributes sometimes choose Autolow2 or autohigh will be more appropriate, no need to always low or best,
    • Flash uses vector graphics to save file size, but it takes a CPU to compute complex graphics and animations. Too many complex filters can consume a lot of memory, and blur filters are 3 less.
    • IE filters are also used to compare memory consumption, but also have compatibility issues. Full-screen translucent is very eating resources.
    • 2*2 's picture is about the same size as the 8*8 picture, but the tiled background 2*2 takes up a lot.
    • GIF animation also has the concept of frame, do not take gif as a flash to play on the line.

Behavior on

    • Do not use a $ () to introduce the entire pretotype or jquery, they have more effect.
    • Ajax is very handsome. But using XML to use XML parsers, some people recommend JSON, but to eval data, you can actually import a script that is already an object. Just want to pass the object name more, or write the object name to die, or like Flickr jsonflickrapi ({"xxx": "XXX"}), directly when function, dig haha.
    • Do not use Display:none to play when you can solve some effects with Visibility:hidden.
    • Here to emphasize JS variables to note the global and local and so the significance is not large, JS complex place is not one or two can be said clearly, pay attention to the monthly shadow of the publication of the book Bar. ^^

In fact, there are a lot of content and how to quickly present our web page similar, but that is to deal with the service-oriented, but in many cases, save the resource consumption of the server at the same time will save the client's resource consumption.

In fact, this article has been squatting in the draft box for a long time, has not been to organize. Now give is not complete, because there is no complete, slowly add it.


    1. Problem: Although it will cause the browser's mode problem, the problem is that it can be solved. Reference serving up XHTML with the correct MIME type, the dispatch XML header browser does not fault-tolerant display, and an error structure causes the entire page to be unable to act.
    2. Autolow: Priority is given to speed, but it will also improve appearance as much as possible. Anti-aliasing is turned off when playback begins. If Flash Player detects that the processor can handle anti-aliasing, it opens the feature.
      Autohigh: The playback speed and appearance are both equal at the beginning, and the appearance is sacrificed when necessary to ensure playback speed. Anti-aliasing is turned on when playback begins. If the actual frame frequency falls below the specified frame rate, anti-aliasing is turned off to improve playback speed. Use this setting to simulate the anti-aliasing command (View > Preview mode > Anti-aliasing).
    3. Blur filters: When using blur filters, if the value used for BlurX and Blury is the integer power of 2 (for example, 2, 4, 8, 16, and 32), you can speed up the calculation and increase performance by 20% to 30% (Flash's help is a sample drop).

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: 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.