-
Notifications
You must be signed in to change notification settings - Fork 326
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
Using BufferedStream over NetworkStream for performance improvement. #1041
Changes from 8 commits
25aed9b
2c902d9
9d28a66
5e3dd9e
4ff6dbe
9dc7001
5f1d758
bff822f
62a1ea9
20192a2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CommunicationUtilities | |
using System.Threading.Tasks; | ||
using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Interfaces; | ||
using Microsoft.VisualStudio.TestPlatform.ObjectModel; | ||
using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; | ||
using Microsoft.VisualStudio.TestPlatform.Utilities; | ||
|
||
/// <summary> | ||
|
@@ -35,7 +36,7 @@ protected SocketClient(Func<Stream, ICommunicationChannel> channelFactory) | |
this.cancellation = new CancellationTokenSource(); | ||
this.stopped = false; | ||
|
||
this.tcpClient = new TcpClient(); | ||
this.tcpClient = new TcpClient { NoDelay = true }; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, As it also says we need for immediate/important communications. In reply to: 137197765 [](ancestors = 137197765) |
||
this.channelFactory = channelFactory; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
namespace Microsoft.VisualStudio.TestPlatform.CommunicationUtilities | ||
{ | ||
public class SocketConstants | ||
{ | ||
// Buffer size for the buffered stream we are using. | ||
public const int BUFFERSIZE = 16384; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: Isn't the MS standard to use PascalCase for constant names? #Closed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces | ||
{ | ||
using System.IO; | ||
|
||
/// <summary> | ||
/// Helper class to return plaform specific stream. | ||
/// </summary> | ||
public interface IStream | ||
{ | ||
/// <summary> | ||
/// Returns platrform specific Buffered Stream with desired buffer size. | ||
/// </summary> | ||
/// <param name="stream">Input Stream</param> | ||
/// <param name="bufferSize">Buffer Size</param> | ||
/// <returns>Buffered Stream</returns> | ||
Stream CreateBufferedStream(Stream stream, int bufferSize); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions | ||
{ | ||
using System.IO; | ||
using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; | ||
|
||
/// <inheritdoc/> | ||
public class PlatformStream : IStream | ||
{ | ||
/// <inheritdoc/> | ||
public Stream CreateBufferedStream(Stream stream, int bufferSize) | ||
{ | ||
return new BufferedStream(stream, bufferSize); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions | ||
{ | ||
using System; | ||
using System.IO; | ||
using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; | ||
|
||
/// <inheritdoc/> | ||
public class PlatformStream : IStream | ||
{ | ||
/// <inheritdoc/> | ||
public Stream CreateBufferedStream(Stream stream, int bufferSize) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions | ||
{ | ||
using System.IO; | ||
using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; | ||
|
||
/// <inheritdoc/> | ||
public class PlatformStream : IStream | ||
{ | ||
/// <inheritdoc/> | ||
public Stream CreateBufferedStream(Stream stream, int bufferSize) | ||
{ | ||
return stream; | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,10 @@ | |
namespace Microsoft.TestPlatform.PerformanceTests | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These changes are not required? #Closed |
||
using System.Diagnostics; | ||
using System.Net; | ||
using System.Text; | ||
using System.Threading; | ||
using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities; | ||
using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Interfaces; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to specify why. #Closed