[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua novice requesting LuaJIT help
- From: Mike Pall <mikelu-1104@...>
- Date: Wed, 20 Apr 2011 10:46:23 +0200
Radu Moraru wrote:
> I am a Lua novice with exactly 4 days of experience in all things Lua. I am
> attempting to integrate LuaJIT in a Visual C++ project that already has Lua
> 5.1 integrated.
The first thing to do is to profile the application to see whether
it spends a non-negligible CPU time in Lua, whether there are too
many API transitions and so on. In short: whether it actually
makes sense to switch to LuaJIT. If you don't know how to do that,
then I suggest to ask the original developer.
[And no, please do not guess. You actually need to profile it.]
> More specifically, the project has Lua 5.1.1, thus I have
> selected LuaJIT-1.1.2 since it is based off that particular
> version.
Err, that doesn't make sense. The x.x.* releases are bug fix
releases, so you certainly want to use the newest one.
> My efforts have been partially successful. With LuaJIT embedded ( or so I
> think ) the scripts are indeed processed, but at no performance gain.
That's why you need to profile it _first_, before even attempting
to switch the VMs.
> The installation instructions also stress the usage of the luaL_openlibs()
> function as defined in the LuaJIT linit.c. This is automatically achieved by
> including the relevant header file, lualib.h, right?
No, it's not. If your source code doesn't contain a reference to
this function, then the source code needs to be changed.
> There is however an installation step whose instructions elude me, the
> installation step that is likely the critical one missing. A consequence of
> me being a novice, I am sure : activating the optimizer.
You can save yourself the trouble by using LuaJIT 2.0. The
embedding instructions are much simpler:
http://luajit.org/install.html#embed
But before you head on: see above about profiling.
--Mike