开发者

What affects browser page rendering performance?

开发者 https://www.devze.com 2023-02-07 13:45 出处:网络
By browser rendering performance I mean things like: scrolling, moving elements in animated fashion, z-order changes.

By browser rendering performance I mean things like: scrolling, moving elements in animated fashion, z-order changes.

In particular I get tremendous slowdown in Firefox 3.6 and IE8 when I move an image with top, left styles over my page. I have no problems with Chrome 8.

With firebug I tried hiding page elements one by one and the largest improvent by far came from the page wide background Jpeg that I use. I wonder how is it affecting performance as the image is moving above another element that obscures the background. This another element is partly transparent PNG (but not in the part the movement happens), maybe this has something to do with it? I use a lot of transparency and CSS3 effects and somehow they slow down everything, even things that look completely unrelated.

Overall I get the impression that the browser is rerendering the w开发者_高级运维hole page when something is moving, instead of only the affected pixels.

Any educated guess as to why all this happens?

EDIT Any picture or text that sits below my moving image causes it to slow down a lot when passing over it. The moving image itself is with transparent background, but changing it to opaque had almost no effect.


Moving a transparent element (particularly an element with a shadow) over a fixed background forces it to be recomposited every frame. Opaque shadowless elements on the other hand can be moved with a simple blit.

If you want to see a huge slowdown in most browsers, make a page with a bunch of elements with border-radius and box-shadow, then set the background of the page to background-attachment:fixed.

0

精彩评论

暂无评论...
验证码 换一张
取 消