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 18B926F3FC; Wed, 8 Sep 2021 21:20:06 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 18B926F3FC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1631125206; bh=A2W/dvi56U6Pvf0OIPbLse3WJjsQPf7RpZ18aEGnPKQ=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=g7kf/mIwIFV5X6Da8W0s1jhIhd59dMQhdfgmdDL2LeTmD6cH7whVILZExNqS13+MW 538MWxh2MYgb2ZMbFeOU+8OyYY2Gd5h4TwTlc8HaYvr+FuJYlaY3dwGP8LBjAyJ548 gu87PonxqZuO7S7yN1N1B5QQOVrroZA3EyKYEOqU= Received: from smtp37.i.mail.ru (smtp37.i.mail.ru [94.100.177.97]) (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 946F86EC55 for ; Wed, 8 Sep 2021 21:20:04 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 946F86EC55 Received: by smtp37.i.mail.ru with esmtpa (envelope-from ) id 1mO2B1-0003tR-HY; Wed, 08 Sep 2021 21:20:03 +0300 To: v.shpilevoy@tarantool.org, imun@tarantool.org Date: Wed, 8 Sep 2021 21:19:58 +0300 Message-Id: X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD91AE02D33A9C88A2F7B0FCECE251A4B9EABD2FC9AA46919D800894C459B0CD1B9F8C727B052B3D80E551A2F1C5E11F43094E6721A1D1978B7B6BD4AB1FA1FD0A3 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7F65C230EDDCD559EEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637B24541F05F0BFC9F8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8DD352FEFE6A660014D4398B36522A546117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC5FC25ED3FCEC3375A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F44604297287769387670735209647ADFADE5905B1618001F51B5FD3F9D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EED76C6ED7039589DE81C726BC2B329815D8FC6C240DEA7642DBF02ECDB25306B2B78CF848AE20165D0A6AB1C7CE11FEE3CF7CD7A0D5AA5F25C0837EA9F3D19764C4224003CC836476EA7A3FFF5B025636E2021AF6380DFAD1A18204E546F3947CB11811A4A51E3B096D1867E19FE1407959CC434672EE6371089D37D7C0E48F6C8AA50765F79006376A91CFDE938F542CEFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A213B5FB47DCBC3458F0AFF96BAACF4158235E5A14AD4A4A4625E192CAD1D9E79D2AE6C3BEB5DE9A26AFB24A999B033BB3 X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975CBF3286B3348795C64D3240231763336EB6E3F59CCBF7818D9C2B6934AE262D3EE7EAB7254005DCED8A4639B0ABC886349510FB958DCE06DB6ED91DBE5ABE359ADBCB5631A0A9D21F5E4DBAB5AF249FA793EDB24507CE13387DFF0A840B692CF8 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D349379E7F8541B6C9A35A38B5EDEBA17B9203623F187056F23EE17E78B7727F7DF2C9899C8CFCC3A171D7E09C32AA3244C8B3836BE9D8046A619CD2EDD22C12C389CA7333006C390A0927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojV8xpaxME9p9mBHrlaKoXQQ== X-Mailru-Sender: 583F1D7ACE8F49BD1042885CEC987B6B009EBD052544766F20E25CF5E1291CB8E28E2421BF3B429A7019711D9D5B048E1458020726E2BC9FD5ECBA0B92C0A936CDC7563AA7CEBD287402F9BA4338D657ED14614B50AE0675 X-Mras: Ok Subject: [Tarantool-patches] [PATCH v4 0/4] fiber: keep reference to userdata if fiber created once 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: Oleg Babin via Tarantool-patches Reply-To: olegrok@tarantool.org Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" From: Oleg Babin This patch reworks approach to fiber management in Lua. Before this patch each action that should return fiber led to new userdata creation that was quite slow and made GC suffer. This patch introduces new field in struct fiber to store a reference to userdata that was created once for a fiber. It allows speedup operations as fiber.self() and fiber.id(). Simple benchmark shows that access to fiber storage is faster in two times, fiber.find() - 2-3 times and fiber.new/create functions don't have any changes. Initially changes were inspired by #6210 [1] but current patchset doesn't introduce anything new just improves performance of existing functions. Some results are available also in related github PR [2]. [1] https://github.com/tarantool/tarantool/issues/6210 [2] https://github.com/tarantool/tarantool/pull/6280 Changes in v4: - Change approach for ref initialization in core/fiber module Changes in v3: - Review fixes by Igor - New patch to make public LUA_NOREF value Changes in v2: - Review fixes by Vlad and Igor - The patch patch that introduced mempool usage is discarded Oleg Babin (4): fiber: rename ref to storage_ref fiber: pass struct fiber into lbox_pushfiber instead of id fiber: correctly initialize storage_ref value fiber: keep reference to userdata if fiber created once src/lib/core/fiber.c | 4 ++ src/lib/core/fiber.h | 9 +++- src/lua/fiber.c | 126 ++++++++++++++----------------------------- 3 files changed, 52 insertions(+), 87 deletions(-) -- 2.32.0