Nate, Michael and François, WDYT?
This is a proof-of-concept that shows a fairly simple approach to avoid a heap allocation for calls that may return more than one member types. It essentially performs an eager `ToV8()` conversion on the creation side rather than deferring it to the generated bindings layer, bypassing not only the heap alloc but also extra dispatch by member type.
The downsides include that we have to pass ScriptState (as it's needed for the conversion) and, at least currently, can't do this for methods with optional params (due to generated code explicitly expecting V8Union... return type, but we may be able to fix it).
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
Introduce UnionReturnProxy to make returning a union cheaperBreadcrumb for future readers: Maybe spell out that this is for cases where we are actually "returning a union" (i.e., there are muliple types we might return), and cases that always return the same type can return that type directly?
TextNode("using Ret = bindings::UnionReturnProxy<{}>;".format(Nit: spell this out? `ReturnProxy`? `OptimizedReturnProxy`?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Commit-Queue | +1 |
Introduce UnionReturnProxy to make returning a union cheaperBreadcrumb for future readers: Maybe spell out that this is for cases where we are actually "returning a union" (i.e., there are muliple types we might return), and cases that always return the same type can return that type directly?
Done
TextNode("using Ret = bindings::UnionReturnProxy<{}>;".format(Nit: spell this out? `ReturnProxy`? `OptimizedReturnProxy`?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |