Serialization opt-in syntax (again)

Brian Goetz brian.goetz at oracle.com
Sun Sep 30 06:59:44 PDT 2012


On Sep 30, 2012, at 9:04 AM, Remi Forax wrote:

> On 09/29/2012 11:14 PM, Brian Goetz wrote:
>>> >Brian, do you have data about the supplementary cost of creating Serializable lambda ?
>> Sadly I do not  yet, and may not for a while.  But I know that there will be a nonzero footprint and capture cost, and it imposes some additional hurdles on some VM optimizations we want to do.  I think that's all the information we will ahve for a while, but I think we have to go on the assumption that the cost will be enough that "make all lambdas serializable" is not a very good choice.
> 
> I've done some tests asking the VM to dump the assembly code so see the impact of having lambdas serializable or not.

Given that we don't have an implementation yet, not sure how you could have done this.  

> First, if the lambda is constant i.e. don't capture any states, then the lambda is created once and reused,

Yes, that's the easy case.  

Also, note that our current translation scheme -- where we generate bytecode for each lambda -- is more serialization friendly than the alternate scheme, where we generate a single wrapper for each SAM and invoke the behavior as an MH.  In the latter case, we have to keep around a lot more information that otherwise would have been thrown away by the MF, such as the captured arguments bound with insertArguments.  

It is NOT going to be free in most cases.  We can do our best to make it small.  





More information about the lambda-spec-experts mailing list