diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-04-24 14:01:20 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-04-24 14:01:20 -0300 |
commit | 3da34a5fa70a51f0cf06d677a4f07b470693260c (patch) | |
tree | 384aeb18a404a076a57188070f1e155a7cc24b3d /ltests.c | |
parent | 20b161e2859837e4f7fb1c19440ad7efe1588f1f (diff) | |
download | lua-3da34a5fa70a51f0cf06d677a4f07b470693260c.tar.gz lua-3da34a5fa70a51f0cf06d677a4f07b470693260c.tar.bz2 lua-3da34a5fa70a51f0cf06d677a4f07b470693260c.zip |
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.)
Diffstat (limited to 'ltests.c')
-rw-r--r-- | ltests.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -1481,6 +1481,15 @@ static int runC (lua_State *L, lua_State *L1, const char *pc) { | |||
1481 | else if EQ("pushvalue") { | 1481 | else if EQ("pushvalue") { |
1482 | lua_pushvalue(L1, getindex); | 1482 | lua_pushvalue(L1, getindex); |
1483 | } | 1483 | } |
1484 | else if EQ("pushfstringI") { | ||
1485 | lua_pushfstring(L1, lua_tostring(L, -2), (int)lua_tointeger(L, -1)); | ||
1486 | } | ||
1487 | else if EQ("pushfstringS") { | ||
1488 | lua_pushfstring(L1, lua_tostring(L, -2), lua_tostring(L, -1)); | ||
1489 | } | ||
1490 | else if EQ("pushfstringP") { | ||
1491 | lua_pushfstring(L1, lua_tostring(L, -2), lua_topointer(L, -1)); | ||
1492 | } | ||
1484 | else if EQ("rawgeti") { | 1493 | else if EQ("rawgeti") { |
1485 | int t = getindex; | 1494 | int t = getindex; |
1486 | lua_rawgeti(L1, t, getnum); | 1495 | lua_rawgeti(L1, t, getnum); |