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/http | |
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/http')
-rw-r--r-- | src/core/ext/filters/http/client_authority_filter.cc | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/core/ext/filters/http/client_authority_filter.cc b/src/core/ext/filters/http/client_authority_filter.cc index 1ca20ebb26..40b3ea22fd 100644 --- a/src/core/ext/filters/http/client_authority_filter.cc +++ b/src/core/ext/filters/http/client_authority_filter.cc @@ -59,9 +59,8 @@ void authority_start_transport_stream_op_batch( initial_metadata->idx.named.authority == nullptr) { grpc_error* error = grpc_metadata_batch_add_head( initial_metadata, &calld->authority_storage, - grpc_mdelem_from_slices( - GRPC_MDSTR_AUTHORITY, - grpc_slice_ref_internal(chand->default_authority))); + grpc_mdelem_from_slices_no_unref(GRPC_MDSTR_AUTHORITY, + chand->default_authority)); if (error != GRPC_ERROR_NONE) { grpc_transport_stream_op_batch_finish_with_failure(batch, error, calld->call_combiner); |