It only allocates a closure if (1) it thinks the delegate may escape the scope and (2) uplevel references are used in the delegate.

The delegate will escape the enclosing scope. I'm wondering if there will still be some kind of scope object allocated to represent escaping values in the englobing stack frame, even when there are no escaping values.

I don't mind paying the small cost of an extraneous null context pointer, but having a whole unnecessary context object allocated seems wasteful.

I strongly suggest trying out a couple examples, and disassembling the result to confirm.

I'll look into that.

Reply via email to