Speaking of object representation, this old-ish MIT paper came up when talking 
to Patrick the other day: http://cscott.net/Publications/lctes03-talk.pdf

In our mobile WebKit benchmarks, ~20% of the power is in memory, and perf 
quickly gets blocked on it.  So, it's worth considering if the object 
representation can go down by a magnitude. Aggressive compression is especially 
attractive for parallel computing because you can trade time for space and win.

I recall three especially cool ideas from the paper:

1. Compress 'mostly' constant fields: only allocate for the typical small case, 
and use a bit flag to indicate an instance where you need to instead do a hash 
lookup. This can be because a value is generally a default, or has a small 
range.

2.  Automatically do this w/ program analysis or profiling. Perhaps a more 
important question for Rust is whether Rust can make optimized access 
safe/transparent, even without autotuning.

3. Hashing the speculation indicators. For example, 1 bit for predictable style 
attributes, another bit for DOM.

- Leo



On Jul 24, 2013, at 12:00 PM, [email protected] wrote:

> Send dev-servo mailing list submissions to
>       [email protected]
> 
> To subscribe or unsubscribe via the World Wide Web, visit
>       https://lists.mozilla.org/listinfo/dev-servo
> or, via email, send a message with subject or body 'help' to
>       [email protected]
> 
> You can reach the person managing the list at
>       [email protected]
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of dev-servo digest..."
> 
> 
> Today's Topics:
> 
>   1.  Inline DOM storage progress report (Josh Matthews)
>   2. Re:  Inline DOM storage progress report (Boris Zbarsky)
>   3. Re:  Inline DOM storage progress report (Patrick Walton)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Tue, 23 Jul 2013 18:34:10 -0400
> From: Josh Matthews <[email protected]>
> To: [email protected]
> Subject: [dev-servo] Inline DOM storage progress report
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> 
> I took the shortest route for prototyping right now and added really 
> basic APIs that did what I needed for our local embedding of 
> Spidermonkey. Accordingly, there are now branches of servo, rust-mozjs, 
> and mozjs (all named 'inline') that contain my work to date on storing 
> DOM objects inline in their JS wrappers' fixed slots. There are some 
> rooting problems that make it crash once in a while, but otherwise 
> test_bindings.html runs to completion on a regular basis.
> 
> Thing to note:
> * Each Option<AbstractNode<ScriptView>> is 16 bytes, so just the base 
> Node is already way over the inline storage limit, leading to the 
> NodeOutOfLine structure in src/script/dom/node.rs.
> 
> See 
> https://github.com/mozilla/servo/commit/5370fc15acbe5d3407d5a97599f6b2fdb780714b
>  
> for the juicy stuff.
> 
> Cheers,
> Josh
> 
> 
> ------------------------------
> 
> Message: 2
> Date: Tue, 23 Jul 2013 22:08:36 -0400
> From: Boris Zbarsky <[email protected]>
> To: [email protected]
> Subject: Re: [dev-servo] Inline DOM storage progress report
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> 
> On 7/23/13 6:34 PM, Josh Matthews wrote:
>> Accordingly, there are now branches of servo, rust-mozjs,
>> and mozjs (all named 'inline') that contain my work to date on storing
>> DOM objects inline in their JS wrappers' fixed slots. There are some
>> rooting problems that make it crash once in a while, but otherwise
>> test_bindings.html runs to completion on a regular basis.
> 
> How does the resulting rust-side code look?  Is is sufficiently like 
> idiomatic rust?
> 
> Basically, would like to avoid us just pushing the complexity of 
> implementing a DOM object from CC boilerplate to access-to-members 
> boilerplate...
> 
>> Thing to note:
>> * Each Option<AbstractNode<ScriptView>> is 16 bytes, so just the base
>> Node is already way over the inline storage limit, leading to the
>> NodeOutOfLine structure in src/script/dom/node.rs.
> 
> Hm.  What are we storing inline, then?  From the diff it looks like 
> basic stuff like parent and owner document and prevsibling is out of 
> line...  What's our inline storage limit?
> 
> -Boris
> 
> 
> ------------------------------
> 
> Message: 3
> Date: Tue, 23 Jul 2013 19:17:10 -0700
> From: Patrick Walton <[email protected]>
> To: [email protected]
> Subject: Re: [dev-servo] Inline DOM storage progress report
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> 
> On 7/23/13 7:08 PM, Boris Zbarsky wrote:
>> On 7/23/13 6:34 PM, Josh Matthews wrote:
>>> Accordingly, there are now branches of servo, rust-mozjs,
>>> and mozjs (all named 'inline') that contain my work to date on storing
>>> DOM objects inline in their JS wrappers' fixed slots. There are some
>>> rooting problems that make it crash once in a while, but otherwise
>>> test_bindings.html runs to completion on a regular basis.
>> 
>> How does the resulting rust-side code look?  Is is sufficiently like
>> idiomatic rust?
>> 
>> Basically, would like to avoid us just pushing the complexity of
>> implementing a DOM object from CC boilerplate to access-to-members
>> boilerplate...
> 
> Note that the Rust compiler is missing a feature needed for automatic 
> generation of trace hooks: external #[deriving] implementations. This is 
> a sub-bug of "allow procedural macros to be defined outside the 
> compiler" (and should be fairly straightforward once that is 
> implemented). This feature is scoped for Rust 1.0 but is not yet 
> implemented.
> 
> Also, I imagine this feature will benefit from the yet-to-be-implemented 
> compiler support for custom smart pointers (and in fact this sort of 
> thing in Servo was much of the reason for my pushing this feature). This 
> should make accessing members of these DOM nodes more idiomatic. My 
> "Removing Garbage Collection from the Rust Language" blog post describes 
> the plan very briefly, but Niko and I need to iron out the exact details 
> still. Work related to this is underway in the Rust compiler (in 
> particular removing `@fn`).
> 
> Patrick
> 
> 
> 
> ------------------------------
> 
> _______________________________________________
> dev-servo mailing list
> [email protected]
> https://lists.mozilla.org/listinfo/dev-servo
> 
> 
> End of dev-servo Digest, Vol 17, Issue 16
> *****************************************

_______________________________________________
dev-servo mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-servo

Reply via email to