-
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
25aed9b
Using BufferedStream over NetworkStream for performance improvement.
navin22 2c902d9
Comments changed & Reverted some changes.
navin22 9d28a66
Merge branch 'master' into socketbufferfix
harshjain2 5e3dd9e
Addressed PR comments.
navin22 4ff6dbe
Merge branch 'socketbufferfix' of https://github.com/navin22/nvstest …
navin22 9dc7001
Adding test for the hang scenario.
navin22 5f1d758
Moving tests from performance folder to platform tests.
navin22 bff822f
Merge branch 'master' into socketbufferfix
harshjain2 62a1ea9
Resolved PR comments.
navin22 20192a2
Merge branch 'socketbufferfix' of https://github.com/navin22/nvstest …
navin22 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/Microsoft.TestPlatform.CommunicationUtilities/SocketConstants.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/IO/IStream.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/Microsoft.TestPlatform.PlatformAbstractions/common/IO/PlatformStream.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/Microsoft.TestPlatform.PlatformAbstractions/netstandard1.0/IO/PlatformStream.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/IO/PlatformStream.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Using
NoDelay = true
can be a bit inefficient.More info here :
https://msdn.microsoft.com/en-us/library/system.net.sockets.tcpclient.nodelay(v=vs.110).aspx #Closed
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.
Yeah, As it also says we need for immediate/important communications.
In reply to: 137197765 [](ancestors = 137197765)