W3C home > Mailing lists > Public > www-style@w3.org > November 2005

Re: Computational complexity of CSS

From: Andrew Fedoniouk <news@terrainformatica.com>
Date: Wed, 16 Nov 2005 09:06:40 -0800
Message-ID: <004101c5ead0$1cb22020$3201a8c0@Terra>
To: "Bjoern Hoehrmann" <derhoermi@gmx.net>
Cc: <www-style@w3.org>

----- Original Message ----- 
From: "Bjoern Hoehrmann" <derhoermi@gmx.net>

>* Andrew Fedoniouk wrote:
>>If let's say in style sheet we have something like this:
>>  select > option { background-color: color1... }
>>  select:focus > option { background-color: color2 ... }
>>(weird but happens)
>>then on focus-out event UA must resolve (find and inherit)
>>styles for all 10,000 items-elements (and their children) of the list.
>>This is serious task for modern hardware.
>>Is anybody looking in this direction or you think
>>this problem is a bit artificial?
> Well, what do you really want to know? It is unlikely that we change CSS
> in a fundamental way such that this problem does not occur, authors are
> not going to put less elements in documents or less rules in stylesheets
> and you are probably not concerned about making microprocessors faster,
> so are you looking for optimizations that could be applied here? Or are
> you concerned about how significant the cascade's performance impact is
> in this case (compared to for example drawing the 10000 items)?
> -- 
> Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de

Purpose of my note is simple: CSS/selectors as system has fundamental
flaw or limitation as you wish -  it can handle small documents and small 
style sets only.

For example system of styles written as :

      background-color: color1
   @:focus option
      background-color: color2

effectively reduces lookup complexity as inner style blocks
need to be scanned only for children of the <select> - not
for all N nodes in the document.

I mean that probably it makes sense:

1) to review current flat model of styles/selectors.
2) while designing new selectors inspect them first
    in respect of the problem.

Andrew Fedoniouk.
Received on Wednesday, 16 November 2005 17:07:50 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:21 UTC