Re: [dev-servo] Crazy idea: CSS selector JITting at parse time

2014-03-31 Thread Keegan McAllister
Or store the metadata immediately before the code, as GHC does for thunk entry code. keegan - Original Message - From: "Niko Matsakis" To: "Patrick Walton" Cc: dev-servo@lists.mozilla.org Sent: Monday, March 31, 2014 3:10:39 AM Subject: Re: [dev-servo] Crazy idea:

Re: [dev-servo] Crazy idea: CSS selector JITting at parse time

2014-03-31 Thread Simon Sapin
On 31/03/2014 16:11, Patrick Walton wrote: On 3/31/14 3:10 AM, Niko Matsakis wrote: Interesting thought. You could also use an embedding involving either coded no-ops at the start of each instruction and/or an unconditional jump over some meta-data. This would reduce coupling at the cost of some

Re: [dev-servo] Crazy idea: CSS selector JITting at parse time

2014-03-31 Thread Niko Matsakis
On Mon, Mar 31, 2014 at 08:11:32AM -0700, Patrick Walton wrote: > I also realized yesterday that one could just re-parse the style > sheet into the AST if the CSSOM or debugging tools are used. I wonder > whether that would be just as fast as disassembling. Good point. I imagine perf of parsing is

Re: [dev-servo] Crazy idea: CSS selector JITting at parse time

2014-03-31 Thread Patrick Walton
On 3/31/14 3:10 AM, Niko Matsakis wrote: Interesting thought. You could also use an embedding involving either coded no-ops at the start of each instruction and/or an unconditional jump over some meta-data. This would reduce coupling at the cost of somewhat more memory. Naturally you'd want to me

Re: [dev-servo] Crazy idea: CSS selector JITting at parse time

2014-03-31 Thread David Rajchenbach-Teller
Still nice. Perhaps it would make a nice project for research students. Cheers, David On Mon Mar 31 04:37:55 2014, Patrick Walton wrote: > Of course, I should try on a snapshot of a real Web page (the HTML5 > spec, perhaps), but I don't expect to do much better. 27% is not bad, > but there are o

Re: [dev-servo] Crazy idea: CSS selector JITting at parse time

2014-03-31 Thread Niko Matsakis
Interesting thought. You could also use an embedding involving either coded no-ops at the start of each instruction and/or an unconditional jump over some meta-data. This would reduce coupling at the cost of somewhat more memory. Naturally you'd want to measure the effect on performance too, though

Re: [dev-servo] Crazy idea: CSS selector JITting at parse time

2014-03-30 Thread Patrick Walton
On 3/29/14 7:22 PM, Patrick Walton wrote: On a related note, I have been tossing around ideas today for using SIMD to match multiple selectors that have the same "shape" in parallel. For example, if we have ".foo #a" and ".bar #a" it may be possible to use the packed comparison instructions in SS

Re: [dev-servo] Crazy idea: CSS selector JITting at parse time

2014-03-29 Thread Patrick Walton
Yes, it does have pretty tight coupling. That is the biggest risk. On a related note, I have been tossing around ideas today for using SIMD to match multiple selectors that have the same "shape" in parallel. For example, if we have ".foo #a" and ".bar #a" it may be possible to use the packed co

Re: [dev-servo] Crazy idea: CSS selector JITting at parse time

2014-03-29 Thread Boris Zbarsky
On 3/29/14 8:23 PM, Patrick Walton wrote: This is just 29 bytes of code when assembled. This is likely larger than the equivalent `nsRuleNode` The right comparison is not nsRuleNode but nsCSSSelector, right? These are actually pretty bloated in Gecko right now. For example, ".foo #a" is pars

[dev-servo] Crazy idea: CSS selector JITting at parse time

2014-03-29 Thread Patrick Walton
Hi everyone, I've been discussing this idea with a few people in person over the past week, and nobody told me it was completely insane. ;) So I thought I'd send this idea around. By now many people have heard of WebKit's CSS JIT. It's a surprisingly small amount of code. One of the issues t