Re: [css-houdini-drafts] [css-layout-api] Lifetime policy for passed in objects, e.g. LayoutChild

The Working Group just discussed `Lifetime for passed in arguments to layout, intrinsicSizes`, and agreed to the following resolutions:

* `RESOLVED: the lifetime of inputs and collections is the same as the policy for worklet swapping`

<details><summary>The full IRC log of that discussion</summary>
&lt;dael> Topic: Lifetime for passed in arguments to layout, intrinsicSizes<br>
&lt;dael> github: https://github.com/w3c/css-houdini-drafts/issues/745<br>
&lt;dael> iank_: We've got a bunch of objecs passed in. layoutChildren most itneresting. You may want something similar as layout instance where you get passed the same child every time.<br>
&lt;dael> Rossen: Or I can stash all the children and look them up<br>
&lt;dael> iank_: But if you pass in new children you can't.<br>
&lt;dael> dbaron: If you have this cache you need to define child ID carefully. If a child changes display-type do you get a different child, if it changes overflow  do you get a different child.<br>
&lt;dael> dbaron: Is this like, do you have a different box type<br>
&lt;dael> iank_: Yes.<br>
&lt;dael> dbaron: Do you have a different box type isn't interop. bllock with and without scrollbars is different for Gecko.<br>
&lt;dael> ??: Does thecalculation matter on times when the child would change?<br>
&lt;dbaron> s/??/biesi/<br>
&lt;dbaron> s/biesi/cbiesinger/<br>
&lt;dael> iank_: The reason you want to use this cache is similar to the gird example where from this currently layout you want to calculate something based on the child's style.<br>
&lt;dael> cbiesinger: You would need to store the old value for that case<br>
&lt;dbaron> (cbiesinger was asking about the risk of a developer caching something that might not be valid after certain types of changes)<br>
&lt;dael> iank_: Right, but string comparision is cheaper then regen the object.<br>
&lt;dael> smfr: Layout child isn't exposed to different custom layout, right?<br>
&lt;dael> iank_: Right. THere's like 2 or 3 polocies here. Like the others we can regen each time. There's also a question about passing in same style map.  We can start with regen each argument call and try and loosen.<br>
&lt;dael> smfr: In the JS can't you say it's read only?<br>
&lt;dael> iank_: Yes, but you can use layout child as a key still.<br>
&lt;dael> smfr: [missed]<br>
&lt;dael> iank_: Yes but this instance.<br>
&lt;dael> smfr: Pure read only is good. caching should be like an API. You want the perf guar that when yourun the code it'll go fast.<br>
&lt;dael> iank_: Cache have structure which is expensive.<br>
&lt;dael> iank_: We've made it faster, but it's not as quick.<br>
&lt;dael> majidvp: You only have to clone the structure when moving global scope.<br>
&lt;dael> iank_: The object will always be alive. So you ahve to call every time<br>
&lt;dael> majidvp: YOu need to serialize and then destructu<br>
&lt;dael> iank_: You have to serialize it out.<br>
&lt;dael> majidvp: Cache is strictly there to help you cache the structure.<br>
&lt;dael> iank_: If you go back to you can twiddle things on the object then you can stay there.<br>
&lt;dael> iank_: That's why I'd like to keep this object for stashing state.<br>
&lt;dael> smfr: Consistant but slow reserialization or a faster but hiccupy. I'd prefer the consistent approach.<br>
&lt;dael> iank_: If we regent each time it depends on number of children by it can be much slower.<br>
&lt;dael> iank_: I can benchmark, but my hunch is creating them each time rather then trying to cache it'll be a substantial difference.<br>
&lt;dael> smfr: You'll pay that in the long rame, though.<br>
&lt;dael> iank_: Yeah. But if you have something deeply bad you'll get it.<br>
&lt;dael> smfr: I think these APIs are problematic if they're not perf guar. If the author wants to do a good job and they're penilized everything 39th frame...<br>
&lt;dael> iank_: That's why you may want to keep the instance around so when scope switching you get the gaur. You've got an instance tied.<br>
&lt;dael> smfr: 2 instances will have the author really confused.<br>
&lt;dael> iank_: If the author never recalcs from the complex thing then you get [missed]<br>
&lt;dael> iank_: What do you want to do?<br>
&lt;dael> Rossen: Since you're the furthest in impl, what do we know so far in terms of requirements, expectations, and patterns.<br>
&lt;dael> iank_: We've got more people using it. We might give this to people and see if they run into issues.<br>
&lt;dael> Rossen: To smfr point and I sympathize, it should be fine to allow custom layout or paint to pass different information between passes.<br>
&lt;dael> Rossen: WE have a few issues. One of defining what the lifetime of the boxes are if this will tie in lifetime of other objects. THis is the point dbaron was making. You'll regenerate boxes different times then Gecko. That's not to say the instances we keep should have same lifetime. That can be based on something else like a display prop changing.<br>
&lt;dael> Rossen: That will get us into trouble as custom prop are more common so we'll again be in a tight place for lifetime.<br>
&lt;dael> Rossen: Other option is to say we have a policy that you need to redo everything at a certain time and that's a fine expectation.<br>
&lt;dael> Rossen: I prefer to be as agressive as possible on cleaning up and resetting. If the explicit stash is needed, define that, give that API, and let people stash something besides custom properties.<br>
&lt;RRSAgent> logging to https://www.w3.org/2018/04/09-houdini-irc<br>
&lt;dael> Rossen: We don't penelize people running on an awesome device.  If we do have to have penalties we have information about what we need to keep.  Seems like the best compromise on both sides of the fence.<br>
&lt;dael> iank_: We can tentatively do that for now and see what happens.<br>
&lt;dael> Rossen: If we want a resolution, not just a tentative what does it mean.<br>
&lt;dael> Rossen: We can introduce and explicit cache which re-writes cache<br>
&lt;dael> iank_: I don't think we want that yet.<br>
&lt;dael> Rossen: Even better.<br>
&lt;dael> iank_: For now instances and layout children get nuked when we switch global scopes<br>
&lt;dael> smfr: why not new children and isntance on invokation?<br>
&lt;dael> iank_: I'm worried about performance. Invoking a constructor is a few ms each time.<br>
&lt;dael> iank_: Let's start with we nuke everything when switching global scopes.<br>
&lt;dael> Rossen: Only thing we're adding is that input are also new instances.<br>
&lt;dael> Rossen: smfr ?<br>
&lt;dael> smfr: I'd prefer the super clean APIs where everything is done internally. Authors won't be surprised. If we do anything else they will get confused.<br>
&lt;dael> iank_: Should we see if authors will get confused?<br>
&lt;dael> smfr: If you can find some that are fresh.<br>
&lt;dael> iank_: We can do an origin question and find out.<br>
&lt;dael> Rossen: Not per call?<br>
&lt;dael> iank_: Yep.<br>
&lt;dael> Rossen: Objections to the lifetime of inputs and collections is the same as the policy for worklet swapping?<br>
&lt;dael> RESOLVED: the lifetime of inputs and collections is the same as the policy for worklet swapping<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/css-houdini-drafts/issues/745#issuecomment-379706347 using your GitHub account

Received on Monday, 9 April 2018 10:25:25 UTC