lua-users home
lua-l archive

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


>  Was there a follow-up to the report of a 4x (runs 4 times longer)
>  performance decrease?  If so, I guess I missed it. (Don't have the item
>  close at hand, but the performance was measured across a html/latex
>  processor I think).
>
>  Just curious if/what/why and if it can be fixed before 3.0.

Yes, see below a copy. After that fix, version 3 alpha appears to be
~10-20% slower than version 2.5. We are working on it, and probably the
final version 3.0 will have the same performance or better than 2.5.

-- Roberto


---------- COPY OF PREVIOUS MESSAGE -----------------
To: lua-l@tecgraf.puc-rio.br
Subject: performance of lua 3.0a
In-reply-to: Your message of "Wed, 16 Apr 1997 02:50:43 -0300."
             <19970416084940.58823@xiron.pc.helsinki.fi> 
Reply-To: roberto@inf.puc-rio.br
Date: Wed, 16 Apr 1997 09:42:40 -0300
From: Roberto Ierusalimschy <roberto@inf.puc-rio.br>

>   An initial test indicates that v3.0a might work OK except for
>   a slowdown by a factor of almost 4 :

  We have detected a "performance bug" in v3.0a which might be responsible
for that. Waldemar Celes has got the same problem, and the profile of his
program starts with:

 18.93%   luaI_travfallbacks
 15.55%   checkfunc
  7.68%   lua_execute

  The problem seems to be in function luaL_arg_check (file auxlib.c). It is
always calling lua_getobjname: This last function is part of the debuger
interface, and it is very very slow (and calls luaI_travfallbacks, which
in turn calls checkfunc). The "bug" is that luaL_arg_check needs to call
lua_getobjname *only* if there is an error, which is very rare. Therefore,
it should be coded like:

void luaL_arg_check(int cond, int numarg, char *extramsg)
{
  if (!cond) {
    char *funcname;
    lua_getobjname(lua_stackedfunction(0), &funcname);
    if (funcname == NULL)
      funcname = "???";
    if (extramsg == NULL)
      luaL_verror("bad argument #%d to function `%s'", numarg, funcname);
    else
      luaL_verror("bad argument #%d to function `%s' (%s)",
                      numarg, funcname, extramsg);
  }
}

(that is, with the call to lua_getobjname inside the "if"). Please try that.


-- Roberto