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

Reduce byte array allocations when reading/writing packets #6023

Merged
merged 8 commits into from Feb 9, 2021

Commits on Jan 11, 2021

  1. Reduce byte array allocations when reading/writing packets

    Byte arrays are a major source of LOH allocations when streaming logging events across nodes. Allocating a large MemoryStream once and then growing it as needed almost completely removes allocations for byte arrays.
    
    This should significantly improve memory traffic during large builds.
    KirillOsenkov committed Jan 11, 2021
    Copy the full SHA
    b7dde7d View commit details
    Browse the repository at this point in the history

Commits on Jan 17, 2021

  1. Write the last part of the packet synchronously on Mono.

    If we use WriteAsync and don't await it, then subsequent WriteAsync may be called before the first continuation returns. If both calls share the same buffer and they overlap, we will overwrite the data in the buffer and cause junk to arrive at receiver.
    KirillOsenkov committed Jan 17, 2021
    Copy the full SHA
    6eb445d View commit details
    Browse the repository at this point in the history

Commits on Jan 25, 2021

  1. Copy the full SHA
    8dea479 View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    7f6b358 View commit details
    Browse the repository at this point in the history
  3. Make SendData write packets asynchronously.

    This avoids blocking the main loop. Roughly equivalent to writing the packet asynchronously using fire-and-forget (BeginWrite).
    KirillOsenkov committed Jan 25, 2021
    Copy the full SHA
    c89545c View commit details
    Browse the repository at this point in the history
  4. Copy the full SHA
    ccfec12 View commit details
    Browse the repository at this point in the history

Commits on Jan 26, 2021

  1. Add comments.

    KirillOsenkov committed Jan 26, 2021
    Copy the full SHA
    4ba9f1a View commit details
    Browse the repository at this point in the history

Commits on Jan 28, 2021

  1. Added a clarification.

    KirillOsenkov committed Jan 28, 2021
    Copy the full SHA
    5eca043 View commit details
    Browse the repository at this point in the history