coroutine icon indicating copy to clipboard operation
coroutine copied to clipboard

compiler: replace coroutine.Yield calls with method call on coroutine context

Open achille-roussel opened this issue 2 years ago • 0 comments

The implementation of coroutine.Yiled is a call to coroutine.LoadContext followed by a call to the Yield method on the returned coroutine context. However, the generated coroutine code makes a call to coroutine.LoadContext when entering a function, in each coroutine the context is already available as a local variable, which means that we are making an extra call to coroutine.LoadContext in coroutine.Yield that could be replaced by a direct method call on the context that we already loaded.

achille-roussel avatar Oct 02 '23 17:10 achille-roussel