From: "Timur Safin" <tsafin@tarantool.org> To: 'Igor Munkin' <imun@tarantool.org>, 'Vladislav Shpilevoy' <v.shpilevoy@tarantool.org>, 'Sergey Ostanevich' <sergos@tarantool.org> Cc: tarantool-patches@dev.tarantool.org Subject: Re: [Tarantool-patches] [PATCH] lua/utils: improve luaT_newthread performance Date: Mon, 20 Jul 2020 15:10:12 +0300 [thread overview] Message-ID: <0f3101d65e8e$b868c810$293a5830$@tarantool.org> (raw) In-Reply-To: <ec0eb12f402d5ea2a37b50212caa66b5808375a6.1595238969.git.imun@tarantool.org> : -----Original Message----- : From: Igor Munkin <imun@tarantool.org> : 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 : + * <lua_newthread> 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_newthread> : + */ : +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
next prev parent reply other threads:[~2020-07-20 12:10 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-07-20 11:28 Igor Munkin 2020-07-20 12:10 ` Timur Safin [this message] 2020-07-22 11:30 ` Sergey Ostanevich 2020-07-22 15:12 ` Igor Munkin 2020-07-24 16:15 ` Sergey Ostanevich 2020-07-24 19:18 ` Igor Munkin 2020-07-23 21:23 ` Vladislav Shpilevoy 2020-07-24 14:14 ` Igor Munkin 2020-07-24 21:47 ` Vladislav Shpilevoy 2020-07-24 21:41 ` Igor Munkin 2020-07-24 21:45 ` Igor Munkin 2020-07-29 13:41 ` Kirill Yukhin
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to='0f3101d65e8e$b868c810$293a5830$@tarantool.org' \ --to=tsafin@tarantool.org \ --cc=imun@tarantool.org \ --cc=sergos@tarantool.org \ --cc=tarantool-patches@dev.tarantool.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH] lua/utils: improve luaT_newthread performance' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox