Revamp of 'lua_pushfstring' / 'luaO_pushvfstring'
The function 'luaO_pushvfstring' now uses an internal buffer to concatenate small strings, instead of pushing all pieces on the stack. This avoids the creation of several small Lua strings for each piece of the result. (For instance, a format like "n: '%d'" used to create three intermediate strings: "n: '", the numeral, and "'". Now it creates none.)
This commit is contained in:
9
ltests.c
9
ltests.c
@@ -1481,6 +1481,15 @@ static int runC (lua_State *L, lua_State *L1, const char *pc) {
|
||||
else if EQ("pushvalue") {
|
||||
lua_pushvalue(L1, getindex);
|
||||
}
|
||||
else if EQ("pushfstringI") {
|
||||
lua_pushfstring(L1, lua_tostring(L, -2), (int)lua_tointeger(L, -1));
|
||||
}
|
||||
else if EQ("pushfstringS") {
|
||||
lua_pushfstring(L1, lua_tostring(L, -2), lua_tostring(L, -1));
|
||||
}
|
||||
else if EQ("pushfstringP") {
|
||||
lua_pushfstring(L1, lua_tostring(L, -2), lua_topointer(L, -1));
|
||||
}
|
||||
else if EQ("rawgeti") {
|
||||
int t = getindex;
|
||||
lua_rawgeti(L1, t, getnum);
|
||||
|
||||
Reference in New Issue
Block a user