Re: Computational complexity of CSS

Malcolm Rowe wrote:
>> ".a1 > .a2" is better than ".a1 .a2"
>> "p[a1]" is better than just "[a1]",
>> etc.
>>
> 
> I think I'm right in saying that at least the second of those will
> actually be _slower_ in Gecko

Depends on what you're measuring.  "p[a1]" will take a tiny bit longer to return 
"true" for such a node, but will take a lot less time to return "false" for 
everything else (because Gecko hashes on tagname, if nothing else).  See David 
Hyatt's excellent article at http://www.mozilla.org/xpfe/goodcss.html for a 
discussion of the Gecko style system and performance.

But yes, I agree that any such suggestion would have to be implementation-dependant.

-Boris

Received on Thursday, 17 November 2005 00:05:01 UTC