From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 9D163445320 for ; Mon, 20 Jul 2020 15:10:16 +0300 (MSK) From: "Timur Safin" References: In-Reply-To: Date: Mon, 20 Jul 2020 15:10:12 +0300 Message-ID: <0f3101d65e8e$b868c810$293a5830$@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Language: ru Subject: Re: [Tarantool-patches] [PATCH] lua/utils: improve luaT_newthread performance List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: 'Igor Munkin' , 'Vladislav Shpilevoy' , 'Sergey Ostanevich' Cc: tarantool-patches@dev.tarantool.org : -----Original Message----- : From: Igor Munkin : Subject: [PATCH] lua/utils: improve luaT_newthread performance : : index b10754e4a..404eafe9b 100644 ... : --- a/src/lua/utils.h : +++ b/src/lua/utils.h : @@ -597,34 +597,16 @@ luaL_checkfinite(struct lua_State *L, struct : luaL_serializer *cfg, : } : : /** : - * @brief A wrapper for lua_newthread() to pass it into luaT_cpcall : - * @param L is a Lua State : - * @sa lua_newthread() : - */ : -static inline int : -luaT_newthread_wrapper(lua_State *L) : -{ : - *(lua_State **)lua_touserdata(L, 1) = lua_newthread(L); : - return 0; : -} : - : -/** : - * @brief Safe wrapper for lua_newthread() : - * @param L is a Lua State : - * @sa lua_newthread() : - */ : -static inline lua_State * : -luaT_newthread(lua_State *L) : -{ : - lua_State *L1 = NULL; : - if (luaT_cpcall(L, luaT_newthread_wrapper, &L1) != 0) { : - return NULL; : - } : - assert(L1 != NULL); : - setthreadV(L, L->top, L1); : - incr_top(L); : - return L1; : -} : + * @brief Creates a new Lua coroutine in a protected frame. If : + * call underneath succeeds, the created Lua state : + * is on the top of the guest stack and a pointer to this state is : + * returned. Otherwise LUA_ERRMEM error is handled and the result : + * is NULL. : + * @param L is a Lua state : + * @sa : + */ : +lua_State * : +luaT_newthread(lua_State *L); : : /** : * Check if a value on @a L stack by index @a idx is an ibuf : -- : 2.25.0 Woohoo! I'm all for this patch - but just to remind all that I need similar patch for 1.10 (because our merger moduels supposed to work there as well) Timur