Earlier quoted context omitted.
It's a little trickier when you do it left to right. Suppose you have a DOM tree like this: div #alert - p, p, p - div #alert - p [lots of children] - p - div #alert [lots of children] [right to left] In order to find all Ps with an #alert parent, you first get a set of all paragraph elements. Most likely a list of all paragraphs is kept in memory, so it can be enumerated quickly. Since DOM trees are generally well b…
Your examples aren't valid HTML, so that approach is fine for quirks mode. But what about valid pages that declare a DOCTYPE? Shouldn't those be parsed from left to right, so the first matching ID that is encountered wins (with any other matching IDs considered errors and disregarded)? OT, this was one of the problems XHTML was supposed to solve, since it was originally assumed by many that pages that weren't well-fo…
A Shocking Truth About CSS
51–60 of 70 posts
Re: A Shocking Truth About CSS
#52Earlier quoted context omitted.
Billions of cycles per second. But executing an instruction frequently takes 20 cycles or so. That reduces instructions to hundreds of millions.
Except that pipelining, multiple cores, and hyperthreading then bring it back up. So, let's not get overly pedantic here.
Re: A Shocking Truth About CSS
#53Earlier quoted context omitted.
Steve's final conclusion: “For most web sites, the possible performance gains from optimizing CSS selectors will be small, and are not worth the costs. ” http://www.stevesouders.com/blog/2009/03/10/performance-impa...
Exactly. I have an obsession with "optimized" markup, that means avoiding unnecessary elements, ids and classes. Let's not forget that all this stuff sits in markup and gets downloaded on each request. Even if that does not add up to much, I still want to have my code "clean". There is one particular site that inspires me: http://camendesign.com/ — take a look, not a single id or class.
Re: A Shocking Truth About CSS
#54Earlier quoted context omitted.
Billions of cycles per second. But executing an instruction frequently takes 20 cycles or so. That reduces instructions to hundreds of millions.
Presumably any modern processor would use some form of pipelining, which I think would take instructions back up into the billions. (The pentium 4, if I recall correctly, had a 20+ stage pipeline)
What you want is a CPU with a short pipeline, a fast clock rate and if possible instruction reordering and multiple dispatch.
Large caches and good branch prediction help a lot too.
Re: A Shocking Truth About CSS
#55(from the header:) The Two Alexs Alexes? Alex's? Alexi? Alexim? In hackanonical form, Alexen. As in oxen, vaxen, boxen.
IIRC oxen is a vestigial dual (not plural) form, so quite appropriate.
From what I can tell, it looks like OE nouns could have either "strong" or "weak" declensions, and this is different from the dual form. Someone on another forum claims that "brethren" is another example.
Re: A Shocking Truth About CSS
#56Earlier quoted context omitted.
IIRC oxen is a vestigial dual (not plural) form, so quite appropriate.
According to http://www.etymonline.com/index.php?term=ox -- "Oxen is the only true survival in Mod.Eng. of the O.E. weak plural." From what I can tell, it looks like OE nouns could have either "strong" or "weak" declensions, and this is different from the dual form. Someone on another forum claims that "brethren" is another example.
Re: A Shocking Truth About CSS
#57Earlier quoted context omitted.
It's a little trickier when you do it left to right. Suppose you have a DOM tree like this: div #alert - p, p, p - div #alert - p [lots of children] - p - div #alert [lots of children] [right to left] In order to find all Ps with an #alert parent, you first get a set of all paragraph elements. Most likely a list of all paragraphs is kept in memory, so it can be enumerated quickly. Since DOM trees are generally well b…
Your examples aren't valid HTML, so that approach is fine for quirks mode. But what about valid pages that declare a DOCTYPE? Shouldn't those be parsed from left to right, so the first matching ID that is encountered wins (with any other matching IDs considered errors and disregarded)? OT, this was one of the problems XHTML was supposed to solve, since it was originally assumed by many that pages that weren't well-fo…
Isn't it just easier to teach web developers to write their DOM selectors in a specific way? The R2L approach is (a) easy to understand (b) has predictable (and stable) performance (c) doesn't malloc (d) is easy to implement. I see this as a simple case of "good enough".
Re: A Shocking Truth About CSS
#58Earlier quoted context omitted.
> a computer capable of executing millions of instructions per second Billions, not millions.
Billions of cycles per second. But executing an instruction frequently takes 20 cycles or so. That reduces instructions to hundreds of millions.
Most instructions have not taken over 2 cycles on x86 since P4. This is a mesofact, update your worldview. :)
Re: A Shocking Truth About CSS
#59Scroll to the botom, and: 11:44:33 AM Alex K: that makes it sound like it may not be worth huge optimization? 11:44:46 AM Alex M: no, not really
Thanks for all the comments, everyone! Very cool to have that post picked up by Hacker News.
Re: A Shocking Truth About CSS
#60(from the header:) The Two Alexs Alexes? Alex's? Alexi? Alexim? In hackanonical form, Alexen. As in oxen, vaxen, boxen.
Thanks for the words!
Alex K
PS I appreciate how strong codex/codices example is, but, well, Alices, not so much.