diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-07-05 17:31:14 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-07-05 17:31:14 -0300 |
| commit | 654b16e83aad64643d524295300cf29677b7f2ba (patch) | |
| tree | 2db8ea2d0b7d9a12daa0691e3a966fe05751a0f0 /ltests.c | |
| parent | dc4e0ecdafbdd2e0f936680ccc703b663260407e (diff) | |
| download | lua-654b16e83aad64643d524295300cf29677b7f2ba.tar.gz lua-654b16e83aad64643d524295300cf29677b7f2ba.tar.bz2 lua-654b16e83aad64643d524295300cf29677b7f2ba.zip | |
better performance for table operations (mainly for integer indices)
Diffstat (limited to 'ltests.c')
| -rw-r--r-- | ltests.c | 8 |
1 files changed, 3 insertions, 5 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltests.c,v 1.85 2001/06/28 15:06:20 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 1.86 2001/06/28 19:58:57 roberto Exp roberto $ |
| 3 | ** Internal Module for Debugging of the Lua Implementation | 3 | ** Internal Module for Debugging of the Lua Implementation |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -251,13 +251,11 @@ static int hash_query (lua_State *L) { | |||
| 251 | lua_pushnumber(L, tsvalue(luaA_index(L, 1))->tsv.hash); | 251 | lua_pushnumber(L, tsvalue(luaA_index(L, 1))->tsv.hash); |
| 252 | } | 252 | } |
| 253 | else { | 253 | else { |
| 254 | Hash *t; | ||
| 255 | Node n; | ||
| 256 | TObject *o = luaA_index(L, 1); | 254 | TObject *o = luaA_index(L, 1); |
| 255 | Hash *t; | ||
| 257 | luaL_checktype(L, 2, LUA_TTABLE); | 256 | luaL_checktype(L, 2, LUA_TTABLE); |
| 258 | t = hvalue(luaA_index(L, 2)); | 257 | t = hvalue(luaA_index(L, 2)); |
| 259 | setobj(key(&n), o); | 258 | lua_pushnumber(L, luaH_mainposition(t, o) - t->node); |
| 260 | lua_pushnumber(L, luaH_mainposition(t, &n) - t->node); | ||
| 261 | } | 259 | } |
| 262 | return 1; | 260 | return 1; |
| 263 | } | 261 | } |
