If anyone is interested in seeing an extreme example of this, search for AsyncUnicodeScalarSequence
here, and take a look at its next()
implementation. After inlining this ends up compiling down to just a handful of arithmetic and branch instructions, with no calls or async overhead. _AsyncBytesBuffer
does the same trick, but is a little more tangly to read.
2 Likes