[Tarantool-patches] [PATCH] lua/utils: improve luaT_newthread performance
Timur Safin
tsafin at tarantool.org
Mon Jul 20 15:10:12 MSK 2020
: -----Original Message-----
: From: Igor Munkin <imun at 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
More information about the Tarantool-patches
mailing list