Reduce memory and CPU usage by optimizing webpage pages _ HTML/Xhtml _ web page creation
Source: Internet
Author: User
Some web pages do not look big, but they are very slow to open. Some web pages are long but smooth to use, which affects the memory and CPU usage of users' computers. Browser problems may be affected by the memory processing problems of their respective browsers, but there is almost no way to control them. For Windows: & middot; IE series, refresh is not much collected, but the minimum will release the memory. & M some web pages do not look big, but they are very slow to open. Some web pages are long but smooth to use, which affects the memory and CPU usage of users' computers.
Browser problems, Some browsers will affect the memory processing, but there is almost no way to control it. On Windows:
· In the IE series, the amount of refresh and recycle is small, but the memory will be released to a minimum.
· Firefox2 is also said to be recycled in a minimal manner, but I have never seen the most spam, and basically never recycled it. It is said that prototype ajax will also cause a constant increase in memory.
· Opera is the best. It has been well controlled. There is no problem.
· The Memory Allocation Mechanism in Linux is different from that in Win. If the browser occupies light, the system may be killed.
Page problems, the browser rendering page will consume memory and CPU, can be reduced by a little.
Structure
Use DocType to tell the browser what you are using. html4 also has a DTD. Maybe Transitional is more suitable for you
If you are using XHTML and can maintain a good structure, remember to output the corresponding MIME and XML header 1, which can reduce the browser code check,
Keep the structure complete. Do not allow the browser to complete the code for you.
To control the page file size, you can use a program to remove the indentation that is more comfortable to see the code. 2 ~ 3 K is also the size.
Iframe will generate new pages. In fact, there are many ways to replace iframe
The introduced JS and CSS can be merged as appropriate, and the background images can also be merged, even some people even combine Flash to add the width attribute to the content image/Object with a known width to reduce partial re-rendering of the page.
Performance
In most cases, only jpg with a quality of 99 and 70 has a different size. The same is true for gif images, especially small icons. The difference between 256 and 128 colors is the file size.
Flash is too fast to eat a lot of CPU, the number of frames per second and the animation effect can be reduced, if the quality is low to show will save a lot of resources, but this sacrifices the effect .. Sometimes Autolow2 or Autohigh is more suitable for the quality attribute, and it is not necessary to keep low or best,
Using a vector graph in flash saves the file size, but the CPU is used to compute complex graphics and animations. If there are too many filters, they will occupy a large amount of memory, and the blur filter will be reduced by 3.
The IE filter also occupies memory and has compatibility problems. Full-screen translucent is very resource-consuming.
The size of the 2*2 image is similar to that of the 8*8 image, but the tiled Background 2*2 is much larger.
Gif animation also has the concept of frame. Do not use gif as flash.
Action
Don't introduce the entire prototype or jQuery in order to use a $ (). They have more functions.
AJAX is very handsome. However, xml parser is used for XML parsing. JSON is recommended for some people. However, to use eval data, you can directly import the object script to use it. You only need to pass an object name multiple times, or write the object name to death, or use jsonFlickrApi ({"xxx": "xxx"}) as a function like flickr.
When using visibility: hidden to implement some effects, do not use display: none.
It doesn't make much sense to emphasize the global and local aspects of js variables here. JS is not exactly a word or two in complicated aspects. Let's take a look at the new book that is being published by yueying.
In fact, many of the content here is similar to how to quickly present our webpage. However, this article focuses on processing the server, but in many cases, this reduces server resource consumption and client resource consumption.
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