aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/csharp
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@google.com>2017-05-16 19:55:57 +0200
committerGravatar Jan Tattermusch <jtattermusch@google.com>2017-05-18 11:14:33 +0200
commitd7079b20080646a11a4878ab156912777fac3248 (patch)
treec06c4b8538a5aabea7e55d20b4bcdc33c0a6395f /src/csharp
parent8ca0055633a663a3a1f832221191a160f500dea2 (diff)
cache byteBufRequest for generic C# qps client
Diffstat (limited to 'src/csharp')
-rw-r--r--src/csharp/Grpc.IntegrationTesting/ClientRunners.cs9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/csharp/Grpc.IntegrationTesting/ClientRunners.cs b/src/csharp/Grpc.IntegrationTesting/ClientRunners.cs
index c9f7c42b71..85d58ec287 100644
--- a/src/csharp/Grpc.IntegrationTesting/ClientRunners.cs
+++ b/src/csharp/Grpc.IntegrationTesting/ClientRunners.cs
@@ -140,6 +140,7 @@ namespace Grpc.IntegrationTesting
readonly ClientType clientType;
readonly RpcType rpcType;
readonly PayloadConfig payloadConfig;
+ readonly Lazy<byte[]> cachedByteBufferRequest;
readonly Histogram histogram;
readonly List<Task> runnerTasks;
@@ -155,6 +156,7 @@ namespace Grpc.IntegrationTesting
this.clientType = clientType;
this.rpcType = rpcType;
this.payloadConfig = payloadConfig;
+ this.cachedByteBufferRequest = new Lazy<byte[]>(() => new byte[payloadConfig.BytebufParams.ReqSize]);
this.histogram = new Histogram(histogramParams.Resolution, histogramParams.MaxPossible);
this.runnerTasks = new List<Task>();
@@ -286,7 +288,7 @@ namespace Grpc.IntegrationTesting
private async Task RunGenericStreamingAsync(Channel channel, IInterarrivalTimer timer)
{
- var request = CreateByteBufferRequest();
+ var request = cachedByteBufferRequest.Value;
var stopwatch = new Stopwatch();
var callDetails = new CallInvocationDetails<byte[], byte[]>(channel, GenericService.StreamingCallMethod, new CallOptions());
@@ -351,11 +353,6 @@ namespace Grpc.IntegrationTesting
};
}
- private byte[] CreateByteBufferRequest()
- {
- return new byte[payloadConfig.BytebufParams.ReqSize];
- }
-
private static Payload CreateZerosPayload(int size)
{
return new Payload { Body = ByteString.CopyFrom(new byte[size]) };