From commits-return-48483-archive-asf-public=cust-asf.ponee.io@qpid.apache.org Mon Jul 1 12:19:54 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 8ABFA180763 for ; Mon, 1 Jul 2019 14:19:54 +0200 (CEST) Received: (qmail 14001 invoked by uid 500); 1 Jul 2019 12:19:50 -0000 Mailing-List: contact commits-help@qpid.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@qpid.apache.org Delivered-To: mailing list commits@qpid.apache.org Received: (qmail 13992 invoked by uid 99); 1 Jul 2019 12:19:50 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Jul 2019 12:19:50 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 18A1B87AD8; Mon, 1 Jul 2019 12:19:50 +0000 (UTC) Date: Mon, 01 Jul 2019 12:19:51 +0000 To: "commits@qpid.apache.org" Subject: [qpid-dispatch] 01/01: DISPATCH-1379: Performance improvement in message receive MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit From: chug@apache.org In-Reply-To: <156198358998.20652.13805011901009800606@gitbox.apache.org> References: <156198358998.20652.13805011901009800606@gitbox.apache.org> X-Git-Host: gitbox.apache.org X-Git-Repo: qpid-dispatch X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Rev: c46fe7911becba624cd9ba7713ace2f02f63febe X-Git-NotificationType: diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated Message-Id: <20190701121950.18A1B87AD8@gitbox.apache.org> This is an automated email from the ASF dual-hosted git repository. chug pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git commit c46fe7911becba624cd9ba7713ace2f02f63febe Author: Chuck Rolke AuthorDate: Mon Jul 1 08:02:05 2019 -0400 DISPATCH-1379: Performance improvement in message receive * Eliminate three function calls per message * Refer to consecutive memory locations in a more cache-friendy way * Free unused buffer outside of content lock --- src/message.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/message.c b/src/message.c index 2335fed..785866b 100644 --- a/src/message.c +++ b/src/message.c @@ -887,13 +887,13 @@ qd_message_t *qd_message() return 0; DEQ_ITEM_INIT(msg); + msg->cursor.buffer = 0; + msg->cursor.cursor = 0; + msg->sent_depth = QD_DEPTH_NONE; DEQ_INIT(msg->ma_to_override); DEQ_INIT(msg->ma_trace); DEQ_INIT(msg->ma_ingress); msg->ma_phase = 0; - msg->sent_depth = QD_DEPTH_NONE; - msg->cursor.buffer = 0; - msg->cursor.cursor = 0; msg->send_complete = false; msg->tag_sent = false; msg->is_fanout = false; @@ -1265,9 +1265,8 @@ qd_message_t *qd_message_receive(pn_delivery_t *delivery) // if (!msg) { msg = (qd_message_pvt_t*) qd_message(); - qd_link_t *qdl = (qd_link_t *)pn_link_get_context(link); qd_connection_t *qdc = qd_link_connection(qdl); - set_safe_ptr_qd_link_t(pn_link_get_context(link), &msg->content->input_link_sp); + set_safe_ptr_qd_link_t(qdl, &msg->content->input_link_sp); msg->strip_annotations_in = qd_connection_strip_annotations_in(qdc); pn_record_def(record, PN_DELIVERY_CTX, PN_WEAKREF); pn_record_set(record, PN_DELIVERY_CTX, (void*) msg); @@ -1277,7 +1276,7 @@ qd_message_t *qd_message_receive(pn_delivery_t *delivery) // The discard flag indicates we should keep reading the input stream // but not process the message for delivery. // - if (qd_message_is_discard((qd_message_t*)msg)) { + if (msg->content->discard) { return discard_receive(delivery, link, (qd_message_t *)msg); } @@ -1306,6 +1305,7 @@ qd_message_t *qd_message_receive(pn_delivery_t *delivery) if (at_eos || recv_error) { // Message is complete + qd_buffer_t * pending_free = 0; // free empty pending buffer outside of lock LOCK(content->lock); { // Append last buffer if any with data @@ -1317,7 +1317,7 @@ qd_message_t *qd_message_receive(pn_delivery_t *delivery) content->pending); } else { // pending buffer is empty - qd_buffer_free(content->pending); + pending_free = content->pending; } content->pending = 0; } else { @@ -1332,6 +1332,9 @@ qd_message_t *qd_message_receive(pn_delivery_t *delivery) pn_record_set(record, PN_DELIVERY_CTX, 0); } UNLOCK(content->lock); + if (!!pending_free) { + qd_buffer_free(content->pending); + } break; } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org For additional commands, e-mail: commits-help@qpid.apache.org