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 75AB06EC58; Wed, 4 Aug 2021 02:06:16 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 75AB06EC58 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1628031976; bh=TXZKRKn8WIcApQ/quSy0d+TjHgcwCxvB6RfwwxrfQs4=; 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=tylLTCk2pKKeU4mE4qjynu8hEbIeU8sS0W/jaiN5r8uRIREkpR5jCSif9rN8BMjim SgoPzv2JfwcuZ7M2s8/4XdvDQRvgohzjBehBELS+V8/shxk8NJ2sKPVMyoV6NXcizG bTyYdVEfu+kf/kpCekT/T3JZbyvKwIbJCPe0dfk0= Received: from smtpng3.i.mail.ru (smtpng3.i.mail.ru [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 3AF9F6EC58 for ; Wed, 4 Aug 2021 02:06:06 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 3AF9F6EC58 Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1mB3U5-0007hH-Av; Wed, 04 Aug 2021 02:06:05 +0300 To: Vladimir Davydov Cc: tarantool-patches@dev.tarantool.org References: <5bc68e715031c04ebb022c70cf4ff27c0939598c.1627024646.git.vdavydov@tarantool.org> <9dbecb42-b2c8-ff46-ef1c-c8c14f19357f@tarantool.org> <20210803154416.3zx5t4jkdyh7adhy@esperanza> Message-ID: <6d4d06a2-c1ea-bb3a-2b97-537d538b75e3@tarantool.org> Date: Wed, 4 Aug 2021 01:06:04 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <20210803154416.3zx5t4jkdyh7adhy@esperanza> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-7564579A: 78E4E2B564C1792B X-77F55803: 4F1203BC0FB41BD941C43E597735A9C3FDAB68B812060C77E97CF8617D978122182A05F5380850408472F32C3F2167FF7683E27F36A336A811A995342A3EFD93113EF618B6B66C98 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7C27E92EFAD44F80DEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637F9CBC1404CDFA5A08638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D84CD74923123BAC6879EEA42104B2E801117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC2EE5AD8F952D28FBA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F44604297287769387670735201E561CDFBCA1751F2CC0D3CB04F14752D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B613439FA09F3DCB32089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A213B5FB47DCBC3458834459D11680B505E080CC72D5A361E377A9B845789E79BA X-C1DE0DAB: 0D63561A33F958A54673C9472E039CC3583B29429E0827A090962EF991EDD428D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA751B940EDA0DFB0535410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D349DAEDEF7DE8FDCFA67252DA5EFD0E2B663B4F45C43FC9BA0D732F9FAB46D37234F320A87E40F11B91D7E09C32AA3244C0B08848E1A0DDCA33D1E20DC39664A8360759606DA2E136A729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojeDyvyeZJDJFOJi0N4hzZMg== X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5D77CF5ABA99083B98DF83C3AA879F92AD3841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH 13/20] net.box: rewrite send_and_recv_{iproto, console} in C 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: Vladislav Shpilevoy via Tarantool-patches Reply-To: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" >>> + local hdr, body_rpos, body_end = internal.send_and_recv_iproto( >> >> 3. Indexing 'internal' via '.' is not free. It is a lookup >> in a hash. You might want to save internal.send_and_recv_iproto into >> a global variable when the module loads first time and use the >> cached value. Non-cached version is a bit faster only for FFI, but >> here you are using Lua C - cache should be good. >> >>> + connection:fd(), send_buf, recv_buf, timeout) >> >> Another idea is to cache 'connection:fd()' result into a variable in >> the root of create_transport() function. And update it when the >> connetion is re-established. Although you probably move this all to >> C later as well, I didn't reach the last commits yet. > > The calling function is moved to C later in the patch set so these > comments will become irrelevant. > > Regarding caching function name (instead of accessing via dot operator), > eventually there will be only two hot C functions that could benefit > from this: > > internal.perform_request > internal.perform_async_request > > I tried caching their names, but saw no performance gain at all in my > test. I also tried removing fiber_self and fiber_clock aliases from > net_box.lua and accessing these functions as fiber. - again no > difference. Both can be explained by jitting. I wasn't sure if 'internal' is jitted, but seems so. While jit works, there probably won't be any difference. Now it is just inconsistent because you have a couple of methods cached: local encode_method = internal.encode_method local decode_greeting = internal.decode_greeting The commit LGTM anyway.