Skip to content

Conversation

@JamesNK
Copy link
Member

@JamesNK JamesNK commented Aug 15, 2020

Avoid foreach over ReadOnlySequence<byte> when it is a single segment.

@davidfowl
Copy link
Member

What kinda gains are you seeing?

@JamesNK
Copy link
Member Author

JamesNK commented Aug 15, 2020

I didn't microbenchmark. It showed up in benchmark and seems like a simple thing to improve.

image

}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void CopyTo(in this ReadOnlySequence<byte> buffer, PipeWriter pipeWriter)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should add this to ReadOnlySequence the target would be an IBufferWriter

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add it to runtime? Could do. It has this today:

    public static class BuffersExtensions
    {
        public static void Write<T>(this IBufferWriter<T> writer, ReadOnlySpan<T> value)
        {
        }
    }

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davidfowl
Copy link
Member

Put this in the RC1 branch

@JamesNK JamesNK changed the base branch from master to release/5.0 August 17, 2020 21:41
@JamesNK JamesNK added this to the 5.0.0-rc1 milestone Aug 18, 2020
@JamesNK JamesNK added the tell-mode Indicates a PR which is being merged during tell-mode label Aug 18, 2020
@JamesNK JamesNK merged commit 592cea6 into release/5.0 Aug 18, 2020
@JamesNK JamesNK deleted the jamesnk/sequencecopier branch August 18, 2020 07:37
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions tell-mode Indicates a PR which is being merged during tell-mode

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants