From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id BBEEF70202; Wed, 24 Feb 2021 12:48:09 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org BBEEF70202 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1614160089; bh=KvrurZEI6fjwUcww87jl8x+4XD32aVaKQIlurhYrAD8=; h=To:Cc:References:Date:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=PoP34Fx2mUse/VBzZB98IyeH2UM52mDPbhsjNd618HpftS/+7cvmXnX6TzKSGgWWd eIGN7O9QjpMamm3TfFofkV5m5dOoJeAKHOsYf8W8D6CQ+PyZhiZY8su/BkbtBXLr5l 2MT2CkJ5liLDcwayf6d4Xy6PyucWJD60dBqHg0JE= Received: from smtp52.i.mail.ru (smtp52.i.mail.ru [94.100.177.112]) (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 B229370202 for ; Wed, 24 Feb 2021 12:48:08 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org B229370202 Received: by smtp52.i.mail.ru with esmtpa (envelope-from ) id 1lEqm8-0001UX-1m; Wed, 24 Feb 2021 12:48:08 +0300 To: Vladislav Shpilevoy , gorcunov@gmail.com Cc: tarantool-patches@dev.tarantool.org References: <20210212112541.27561-1-sergepetrenko@tarantool.org> <57b04874-1bb7-3d62-856d-b60df700514a@tarantool.org> <774363df-6be5-a7b4-ea7f-d72903f3c409@tarantool.org> Message-ID: Date: Wed, 24 Feb 2021 12:48:07 +0300 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD975C3EC174F5669221340953D8FEAAFCA26BB79E5C093AA91182A05F53808504059B32C3D23B9F9067E82870EB29A7F33ECEA8324CEF7590326F5FB875820A055 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE74FC7AD0AD96C1577EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637578F58D66D7052C48638F802B75D45FF5571747095F342E8C7A0BC55FA0FE5FC48EFCC6C8EB03FE66B9905273CF2483258B348B79687F449389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C0ECC8AC47CD0EDEFF8941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B6B0E9FD5D4288160ECC7F00164DA146DA6F5DAA56C3B73B23C77107234E2CFBA567F23339F89546C55F5C1EE8F4F765FCD5DDBEEAE3B12F1775ECD9A6C639B01BBD4B6F7A4D31EC0BC0CAF46E325F83A522CA9DD8327EE4931B544F03EFBC4D575E1C53F199C2BB95B5C8C57E37DE458B4C7702A67D5C3316FA3894348FB808DB48C21F01D89DB561574AF45C6390F7469DAA53EE0834AAEE X-B7AD71C0: 502860A5C27E5D50661228F9A2C48A933DA88A7D86D98B915C0AF1600DCBC20BDD0D5C1FF1EAB3C3126DECDF20510FF1 X-C1DE0DAB: 0D63561A33F958A50E0A384C45F5C6EBE5398CC78E675E6A80E0913658627127D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75B7BFB303F1C7DB4D8E8E86DC7131B365E7726E8460B7C23C X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34AF12ADB97C97CD89768D16279381DFEFE81AFF9E3177294335D8024DAB56F7911FB016ED14B027851D7E09C32AA3244C8EB425E22220A342321625900938828B3E8609A02908F271FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojyK6JYJ15DtI3V9IFrQH6hQ== X-Mailru-Sender: 3B9A0136629DC9125D61937A2360A446AC7BB1DCFF5C3DF0EB41E101537D5713EDB8A17F51B879CB424AE0EB1F3D1D21E2978F233C3FAE6EE63DB1732555E4A8EE80603BA4A5B0BC112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH] relay: yield explicitly every N sent rows X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Serge Petrenko via Tarantool-patches Reply-To: Serge Petrenko Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 24.02.2021 01:30, Vladislav Shpilevoy пишет: > Thanks for the patch! Thanks for the reivew! >>>> diff --git a/src/box/relay.cc b/src/box/relay.cc >>>> index 1d8edf116..6d9269e1d 100644 >>>> --- a/src/box/relay.cc >>>> +++ b/src/box/relay.cc >>>> @@ -117,6 +117,11 @@ struct relay { >>>>           * is passed by the replica on subscribe. >>>>           */ >>>>          uint32_t id_filter; >>>> +       /** >>>> +        * How many rows has this relay sent to the replica. Used to yield once >>>> +        * in a while when reading a WAL to unblock the event loop. >>>> +        */ >>>> +       size_t row_cnt; > Name is a bit ugly, because all the other members are not > contractions. They use full words. But up to you. No problem, changed to `row_count`. >>> 1. But it is not a size of anything, right? Maybe make it >>> int64_t then? >> uint64_t, probably? > Nope, int64_t. It is supposed to be 'faster'. Because it does > not have defined overflow rules, and therefore the hardware does > not need to handle it. > > But honestly, I didn't measure. For me it is more cargo cult. I > just use signed integers where I can assuming that the hardware > really may omit an instruction or so. > > Up to you. Long story short, I'd like to leave it as is. Besides, we have an unsigned type (size_t) in local recovery. Ok, now I see what you meant. I never thought of this, and brief googling showed no signs of a speedup with signed arithmetic vs unsigned. Actually, the standard says signed overflow is an undefined behaviour while an unsigned overflow should result in a wrap (modulo 2^64 in our case). Do you think this wrap may be costly on some architecture? > > The patch about power of 2 worked btw. This is how it looks now: > > andq $0x7fff, %rcx ; imm = 0x7FFF > > this is how it used to look: > > movl $0x7d00, %ecx ; imm = 0x7D00 > divq %rcx Yeah, that was a nice catch. -- Serge Petrenko