kenny heaton wrote:
>I've heard talk about how much faster css is at rendering pages than
>table layouts, but I've never seen the proof (actual statistics). I
>was wondering if anyone knew of a study on this.
I don't think a general study is possible, since the rendering time
depends largely on exactly what it is you are laying out and what
browser you are using to do so. A table can, for example, render
faster than a complex series of CSS floats. On the other hand, CSS
which relies on relative positioning and only a few "layers"
(absolute positioning or floats) is generally considerably faster
than a table for the same job. CSS generally (but not always) ends
up lighter weight in total than a table-based layout, and it has the
advantage that the CSS portion can be cached. This can lead to
significant savings under most real-world conditions. Try it yourself to see.
However, look carefully at any test that makes a general claim that
one is always faster than the other. It just isn't so.
>My second questions is related to that, dose anyone know of any
>resources on writing more optimised css. For example I was just
>reading on this list in the talk comparing class to id and there was
>mention there was performance difference between
>
>element.class {}
>and
>.class {}
I'm the one who brought up this performance difference, and I was
careful to qualify that I only knew the facts for one browser (in
this case, Mozilla). A general attempt to optimize CSS may not even
be possible. Each browser vendor is free to optimize page display in
any way they can think of. Because of the specific way that Mozilla
has optimized selector matching, a class or ID without the element is
*slightly* faster to match than one that includes the element. That
may or may not be true with some other browser (and it might be
difficult to even discover in anything other than an open-source
implementation, unless you are willing to do brute-force technical
testing on thousands of combinations).
I think it is likely that optimizing CSS is probably not worth your
time. In addition to significant browser and platform differences,
network latency, page weight, and other overhead will most likely
completely overwhelm any effects from the CSS, which has been written
explicitly with progressive rendering (i.e. speed) in mind. There
are a few CSS3 properties that may have more significant effects, but
for now, if browsers support it, it is probably fast enough not to
make much difference.
Mind you, this is anecdotal and somewhat speculative. I know of no
formal testing on the subject that I would consider reliable.
HTH,
-Adam Kuehn
______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/