From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 33AF2445320 for ; Fri, 10 Jul 2020 23:31:24 +0300 (MSK) References: <20200710075605.217824-1-gorcunov@gmail.com> <20200710075605.217824-2-gorcunov@gmail.com> From: Vladislav Shpilevoy Message-ID: Date: Fri, 10 Jul 2020 22:31:22 +0200 MIME-Version: 1.0 In-Reply-To: <20200710075605.217824-2-gorcunov@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Tarantool-patches] [PATCH 1/5] qsync: eliminate redundant writes List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cyrill Gorcunov , tml Hi! On 10/07/2020 09:56, Cyrill Gorcunov wrote: > Instead of updating is_sync variable on every > cycle write it once. > > Signed-off-by: Cyrill Gorcunov > --- > src/box/txn.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/src/box/txn.c b/src/box/txn.c > index a2df23833..49b2b2649 100644 > --- a/src/box/txn.c > +++ b/src/box/txn.c > @@ -567,8 +567,12 @@ txn_journal_entry_new(struct txn *txn) > if (stmt->row == NULL) > continue; > > - is_sync = is_sync || (stmt->space != NULL && > - stmt->space->def->opts.is_sync); > + if (!is_sync) { > + if (stmt->space != NULL && > + stmt->space->def->opts.is_sync) { > + is_sync = true; > + } > + } > > if (stmt->row->replica_id == 0) > *local_row++ = stmt->row; The 'redundant' writes were done intentionally, to avoid unnecessary branching. I see no point in this change.