Skip to content

Commit

Permalink
Update benchmark apps to use optimized way to create ByteString (#1261)
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesNK authored Apr 7, 2021
1 parent 7f34166 commit 2844af7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion perf/benchmarkapps/GrpcClient/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ private static SimpleRequest CreateSimpleRequest()
{
return new SimpleRequest
{
Payload = new Payload { Body = ByteString.CopyFrom(new byte[_options.RequestSize]) },
Payload = new Payload { Body = UnsafeByteOperations.UnsafeWrap(new byte[_options.RequestSize]) },
ResponseSize = _options.ResponseSize
};
}
Expand Down
4 changes: 2 additions & 2 deletions perf/benchmarkapps/Shared/BenchmarkServiceImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public override async Task StreamingBothWays(IAsyncStreamReader<SimpleRequest> r
{
var response = new SimpleResponse
{
Payload = new Payload { Body = ByteString.CopyFrom(new byte[100]) }
Payload = new Payload { Body = UnsafeByteOperations.UnsafeWrap(new byte[100]) }
};
var clientComplete = false;

Expand All @@ -94,7 +94,7 @@ public override async Task StreamingBothWays(IAsyncStreamReader<SimpleRequest> r

public static SimpleResponse CreateResponse(SimpleRequest request)
{
var body = ByteString.CopyFrom(new byte[request.ResponseSize]);
var body = UnsafeByteOperations.UnsafeWrap(new byte[request.ResponseSize]);

var payload = new Payload { Body = body };
return new SimpleResponse { Payload = payload };
Expand Down
2 changes: 1 addition & 1 deletion testassets/BenchmarkWorkerWebsite/BenchmarkServiceImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ await requestStream.ForEachAsync(async request =>

private static Payload CreateZerosPayload(int size)
{
return new Payload { Body = ByteString.CopyFrom(new byte[size]) };
return new Payload { Body = UnsafeByteOperations.UnsafeWrap(new byte[size]) };
}
}
}

0 comments on commit 2844af7

Please sign in to comment.