Some web pages don't look big but will be stuck when opening. Some web pages are long but use smoothly, which affects these things if they occupy the user's computer's memory and CPU.
Browser issues, the memory problems of their respective browsers will be affected, but they are almost impossible to control, on Windows:
In IE series, the amount of refresh recovery is not large, but minimization will free up memory.
Firefox2 is said to be minimizing recycling, but I have never seen the most trashy, and it is basically not recycled. It is said that the ajax of prototype will also cause the memory to continue to increase.
Opera is the best. Always well controlled. There is no problem. .
Linux's memory allocation mechanism is different from Win's. It uses as much as it can. If the browser takes up all the money, it may kill the system.
Page issues, the browser will consume memory and CPU when rendering the page, which can be reduced by a little.
Structurally
Use DocType to tell the browser what you are using, and html4 also has 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's code check.
Keep the structure intact and don't let the browser complete the code for you.
To control the file size of the page, you can indent it in order to read the code more comfortable through the program. 2~3K is also sized.
Iframe will generate new pages, but there are actually many ways to replace iframe
The introduced JS and CSS can be merged appropriately, and the background images can also be merged, and some people even merge Flash.
Adding width attributes to content images/Objects with known width can reduce local re-rendering of pages
Performance
In most cases, the jpg of quality 99 and 70 only has different sizes. The same is true for gifs, especially for small icons. The difference between 256 colors and 128 colors is the file size.
Flash moves too fast and takes a lot of CPU. Controlling the frame rate per second and the effect of animation can be reduced. If you use medium and low display, you will save a lot of resources, but this will sacrifice the effect. . Sometimes it is more suitable to choose Autolow2 or Autohigh, and there is no need to keep low or best.
Flash uses vector graphics to save file size, but it takes CPU to calculate complex graphics and animations. Too many complex filters will take up a lot of memory, and the blur filter will be reduced by 3.
IE filters also occupy more memory and also have compatibility issues. Full screen translucency is very resource-intensive.
The 2*2 picture is about the same size as the 8*8 picture, but the tiled background 2*2 takes up a lot of more.
Gif animation also has the concept of frames. Don’t just use gif as flash to play.
Behavioral
Don't introduce the entire prototype or jQuery with one $(), they have more functions.
AJAX is very handsome. However, using XML parser will be used. Some people recommend using JSON, but in this way, you need eval data. In fact, you can directly import the script that is already an object. Just pass more object names, or write the object names to death, or jsonFlickrApi({xxx:xxx}) like flickr, use them directly as a function, haha.
When you can use visibility:hidden to solve certain effects, don't use display:none to play.
It is not very meaningful to emphasize that js variables should be paid attention to the overall and local, etc., and the complexity of JS is not something that can be explained in one or two sentences. Please pay attention to Yueying’s new book being published. ^^
In fact, there are many of the contents here that are similar to how to quickly present our web pages, but that article mainly deals with the server side, but in many cases, saving the server resource consumption will also save the client resource consumption.
In fact, this article has been squatting in the draft box for a long time and has not had time to organize it. What you give now is not complete, because it is not complete, so please add it slowly.
--------------------------------------------------------------------------------
Problem: Although it will cause a browser pattern problem, the problem can be solved. Refer to Serving up XHTML with the correct MIME type, the sending XML header browser will not display fault tolerantly, and the error structure will cause the entire page to be unable to be displayed.
Autolow: Prioritize speed, but also improve the appearance as much as possible. When playback begins, the anti-aliasing function is turned off. If Flash Player detects that the processor can handle the anti-aliasing feature, it will turn on.
Autohigh: At the beginning, both playback speed and appearance are important, and if necessary, the appearance will be sacrificed to ensure playback speed. When playback begins, the anti-aliasing function is on. If the actual frame rate drops below the specified frame rate, the anti-aliasing function is turned off to increase playback speed. Use this setting to simulate the anti-aliasing command (View > Preview Mode > Anti-aliasing).
Fuzzy filter: When using a fuzzy filter, if the value used for blurX and blurY is an integer power of 2 (for example, 2, 4, 8, 16, and 32), the calculation can be accelerated and performance can be improved by 20% to 30% (flash helps to explain).