lua-users home
lua-l archive

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


The attached code (creating and destroying copies of references) runs in .42
seconds wall time on 5.0.2 for me, and 1.8 seconds on 5.1.

Just pushing the reference (and popping it) is .05 (5.0.2) up to .19 (5.1),
which alone is a huge jump.

Same compiler flags.  Before I spend time trying to track this down, does
anyone know what's up?   I'm using references as a low-level data type,
and I don't want to see a 4:1 overhead increase.

(Pushing a number is .05 up to .08, which is a more reasonable change.
Pushing strings is identical, no change.)

-- 
Glenn Maynard
extern "C"
{
#include <lua.h>
#include <lauxlib.h>
}

main()
{
	lua_State *L = lua_open();

	lua_pushstring( L, "testing" );
	int iReference = luaL_ref( L, LUA_REGISTRYINDEX );

	for(int i = 0; i < 1000000; ++i)
	{
		lua_pushnumber( L, 1.5 );
		int iReference2 = luaL_ref( L, LUA_REGISTRYINDEX );
		luaL_unref( L, LUA_REGISTRYINDEX, iReference2 );
	}
}