[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Extending array types in Ravi
- From: Roberto Ierusalimschy <roberto@...>
- Date: Wed, 4 Nov 2015 19:21:48 -0200
> BTW the cost compared to inline access is significant:
> 1) First luaV_gettable() is called.
> 2) This executes a loop.
> 3) Next check that the variable is a table.
> 4) If so call luaH_get().
> 5) luaH_get() checks that key type
> 6) If integer then calls luaH_getint()
> Which finally executes the code that I would like to generate in step 1.
Yes. I changed the standard implementation to try a "fast track" for
API accesses (lua_geti/lua_getfield/etc., where we know the type of the
key), calling luaH_getint or luaH_getstr directly and going into the
loop etc. only if needed ('t' is not a table, result is nil).