Skip to content

Commit

Permalink
Larger read buffer size (#10)
Browse files Browse the repository at this point in the history
* Larger read buffer size

Increased read buffer size to 4K from 2K, since 4K is a page size.  This decreased the time to read from the console when it's very busy from 5% of total test time, to 3% of total test time.

* Added Comments
  • Loading branch information
BarryNolte authored and doubleyewdee committed Dec 18, 2018
1 parent 8eb3216 commit b49626d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/ConsoleBuffer/ConsoleWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ namespace ConsoleBuffer

public sealed class ConsoleWrapper : IDisposable, INotifyPropertyChanged
{
// Output buffer size for recieving data generated by the console
// This is a page size (4k) which is almost always the most
// efficiant block size to move memory
private const int OutputBufferSize = 4096;

public Buffer Buffer { get; private set; }

public string Command { get; private set; }
Expand Down Expand Up @@ -183,7 +188,7 @@ private void ReadConsoleTask()
{
using (var ptyOutput = new FileStream(this.readHandle, FileAccess.Read))
{
var input = new byte[2048];
var input = new byte[OutputBufferSize];

while (!this.disposed)
{
Expand Down

0 comments on commit b49626d

Please sign in to comment.