lua-users home
lua-l archive

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


On Mon, Sep 25, 2006 at 12:17:16PM +0200, Mike Pall wrote:
> See the patch below. This comes standard with LuaJIT because the
> effect is much more pronounced there.

With this patch, I'm still seeing a 4:1 change in the attached code,
depending on the setting of "fast".  Does it repro for you?

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

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

	lua_pushstring( L, "testing" );
	int index = 1;
	lua_rawseti(L, LUA_REGISTRYINDEX, index++);
	bool fast = true;
	if( fast )
	{
		lua_pushstring( L, "testing" );
		lua_rawseti(L, LUA_REGISTRYINDEX, index++);
	}

	for(int i = 0; i < 1000000; ++i)
	{
		lua_pushnumber( L, 1.5 );
		lua_rawseti(L, LUA_REGISTRYINDEX, index);
		lua_pushnil(L);
		lua_rawseti(L, LUA_REGISTRYINDEX, index);
	}
}