lua-users home
lua-l archive

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


Hi,

Marco Pontello wrote:
> I almost finished integrating DogLua with LuaJIT. Some preliminary
> test show me a speedup between 2x to more than 3x with various
> filters!

This sounds great!

> Considering that much time is spent calling external functions to
> get/set pixels, it seems to me a very nice results!

Transparently add a prologue to every loaded file:

  local math = math
  local get_rgb = get_rgb
  local set_rgb = set_rgb
  [... and so on ...]

Should speed it up even more.

> If there will be some additional speedup dealing with Tables, that
> could be another great boost for filters that makes use of
> tables/matrix.

In fact I can only repeat my suggestion: local, local, local!
Tables are pretty fast now (at least if you use the optimizer).
But you better make them local variables. Dito for temporary
variables (local r,g,b = get_rgb(x, y)). And of course for
locally declared functions, too. Expect another factor of 2x
if you do this.

Bye,
     Mike