Skip to content
Snippets Groups Projects
Commit d7079b20 authored by Jan Tattermusch's avatar Jan Tattermusch
Browse files

cache byteBufRequest for generic C# qps client

parent 8ca00556
No related branches found
No related tags found
No related merge requests found
......@@ -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]) };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment