lua-users home
lua-l archive

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


Lenny Palozzi wrote:
> 
> Does anyone know how tolua and its binding code compares to SWIG's in
> terms of speed?

I can only comment on the SWIG side, a typical wrapper might look like
this:

Wrapped function: NodeType NodeGetNodeType (Node *);

Wrapper code:

static void _wrap_NodeGetNodeType(void) {
  int  _result;
  Node * _arg0;

  if (!lua_isnil (lua_getparam (1))) _arg0 = lua_getuserdata (lua_getparam
(1));
  else _arg0 = NULL;
  _result = (int )NodeGetNodeType(_arg0);
  lua_pushnumber ((double) _result);
}

As you can see, there isn't really much code around the actual function
call "NodeGetNodeType". This surely helps speed-wise, but there is also no
argument checking, so crashing the program is easy... This is of course a
problem with the way SWIGLua generates wrapper code and could be changed.

Regards,

Eckhart

-- 
Universität GH Essen - Wirtschaftsinformatik und Softwaretechnik
Universitätsstr. 9, D-45141 Essen, Raum R09 R02 H18
Tel.: +49 (0201) 183 4075 Fax: +49 (0201) 183 4073
Eckhart.Koeppen@uni-essen.de http://nestroy.wi-inf.uni-essen.de/Koeppen/