Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buffer Socket Reads #167

Merged
merged 1 commit into from Jan 25, 2017
Merged

Conversation

caleblloyd
Copy link
Contributor

  • Fixes Improve async performance #164
  • Uses BufferedByteReader to read up to 16384 bytes out of the OS Socket Buffer at once
  • Changes IByteHandler.ReadAsync method to accept an ArraySegment<byte> buffer parameter that new data is read into

{
m_socketAwaitable.EventArgs.SetBuffer(payload.Array, payload.Offset, payload.Count);
}
m_socketAwaitable.EventArgs.SetBuffer(payload.Array, payload.Offset, payload.Count);
Copy link
Member

Choose a reason for hiding this comment

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

The previous code was intentional: d705e20

I wonder if keeping m_buffer in this new code and copying in/out of it would be an improvement or not.

@bgrainger
Copy link
Member

This PR brings the timings for my test harness to:

.NET Framework sync
real   3.426s
total  1.156s
user   1.156s
sys    0.000s

.NET Framework async
real   3.056s
total  1.438s
user   1.344s
sys    0.094s

.NET Core sync
real   3.564s
total  1.063s
user   1.031s
sys    0.031s

.NET Core async
real   2.769s
total  1.359s
user   1.250s
sys    0.109s

A substantial improvement! 👍

@bgrainger bgrainger merged commit 9a4d8d7 into mysql-net:master Jan 25, 2017
@caleblloyd caleblloyd deleted the f_buffer_network branch February 7, 2017 02:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants