lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


In lvm.c,v 2.61 2006/01/10 12:50:00, in

void luaV_gettable (lua_State *L, const TValue *t,
TValue *key, StkId val) {
  int loop;
  for (loop = 0; loop < MAXTAGLOOP; loop++) {
    const TValue *tm;
    if (ttistable(t)) {  /* `t' is a table? */
      Table *h = hvalue(t);
  ........... [ snip ] ........

would it not be more efficient to lift the evaluation
of ttistable(t) out of the loop?

  int loop, is_a_table;
  is_a_table = ttistable(t);
  for (loop = 0; loop < MAXTAGLOOP; loop++) {
    const TValue *tm;
    if (is_a_table) {  /* `t' is a table? */
  ........... [ snip ] ........

Or have I missed something?
    
-- 
Gavin Wraith (gavin@wra1th.plus.com)
Home page: http://www.wra1th.plus.com/