diff options
author | Soheil Hassas Yeganeh <soheil@google.com> | 2018-10-07 18:41:31 -0400 |
---|---|---|
committer | Soheil Hassas Yeganeh <soheil@google.com> | 2018-10-07 18:41:31 -0400 |
commit | 5faf1b72edba62a06dd6b4273c2a36f570b7c949 (patch) | |
tree | ed84b65e507ab6eb9883ef39f8b349692e0eb800 /src/core/ext/filters/client_channel/client_channel.cc | |
parent | 3b26fe7262a9db90dfb69f84ad582d9f71871a5c (diff) |
Avoid unnecessary ref/unref calls to get mdelem from slices.
grpc_mdelem_from_slices() unref's the key and value. As a result,
in quite a few cases on the hot path, we first ref slice, so that
grpc_mdelem_from_slices() can unref them.
Add grpc_mdelem_from_slices_no_unref() which does not unref() the
input slices. This cuts 0.5% - 1.0% across app benchmarks.
Diffstat (limited to 'src/core/ext/filters/client_channel/client_channel.cc')
-rw-r--r-- | src/core/ext/filters/client_channel/client_channel.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc index 388736b60a..3df5f6f2a0 100644 --- a/src/core/ext/filters/client_channel/client_channel.cc +++ b/src/core/ext/filters/client_channel/client_channel.cc @@ -2211,7 +2211,7 @@ static void add_retriable_send_initial_metadata_op( .grpc_previous_rpc_attempts); } if (GPR_UNLIKELY(calld->num_attempts_completed > 0)) { - grpc_mdelem retry_md = grpc_mdelem_from_slices( + grpc_mdelem retry_md = grpc_mdelem_from_slices_no_unref( GRPC_MDSTR_GRPC_PREVIOUS_RPC_ATTEMPTS, *retry_count_strings[calld->num_attempts_completed - 1]); grpc_error* error = grpc_metadata_batch_add_tail( |