[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: alternative udata checking
- From: Xavier Wang <weasley.wx@...>
- Date: Fri, 2 Dec 2011 18:12:07 +0800
Thank you, I used this method in my project [1], and it really speep
up, now lbuffer module are faster than table.concat in my bench.lua
(in development, not in project).
[1]: https://github.com/starwing/lbuffer
2011/12/2 Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br>:
> Lua 5.2 introduces lua_rawgetp and lua_rawsetp and this makes it simpler to
> use pointers instead of strings as udata types in the registry.
>
> The attached file extends the udata checking in lauxlib.c to use pointers.
> To test it, just #include "udata.c" in your C module. This file assumes
> that you only handle *one* type of udata per module.
>
> I did a quick test with my lrandom and I got a 15% speedup. I'd like to
> hear about the experience of others with this scheme.
>
> The main idea is applicable to 5.1 but you'll need to use lua_pushlightudata
> etc explicitly. See http://lua-users.org/lists/lua-l/2010-11/msg00151.html .