Page 1 of 1

[Linux] Is LUAJIT really working?

PostPosted: Mon Jun 06, 2016 13:54
by JDCodeIt
I have compiled with flag ENABLE_LUAJIT, but I don't see outstanding LUA performance improvement in the server.

Linux's ldd reports that the LUAJIT library is unused - any idea why? The lua wrapper code is definitely being compiled.

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
ldd -u bin/minetestserver
Unused direct dependencies:
   /lib/i386-linux-gnu/libz.so.1
   /usr/lib/i386-linux-gnu/libsqlite3.so.0
   /usr/lib/i386-linux-gnu/libluajit-5.1.so.2
   /lib/i386-linux-gnu/librt.so.1
   /lib/i386-linux-gnu/libpthread.so.0
   /lib/i386-linux-gnu/libncurses.so.5
   /usr/lib/libpq.so.5
   /usr/lib/i386-linux-gnu/libleveldb.so.1
   /usr/lib/i386-linux-gnu/libhiredis.so.0.10
   /usr/lib/i386-linux-gnu/libcurl.so.4
   /lib/i386-linux-gnu/libm.so.6
   /lib/i386-linux-gnu/libgcc_s.so.1

Re: [Linux] Is LUAJIT really working?

PostPosted: Mon Jun 06, 2016 15:25
by rubenwardy
Have you installed the luajit dev libraries?
Does the output of cmake mention "luajit found"

Re: [Linux] Is LUAJIT really working?

PostPosted: Mon Jun 06, 2016 16:26
by JDCodeIt
Yes, installed the dev libraries

The first output of cmake shows it finds the library:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
cmake . -DBUILD_SERVER=TRUE
-- *** Will build version 0.4.14-dev ***
-- Found Irrlicht: /usr/lib/i386-linux-gnu/libIrrlicht.so 
-- Found CURL: /usr/lib/i386-linux-gnu/libcurl.so 
-- cURL support enabled.
-- GetText disabled.
-- Found OpenAL: /usr/lib/i386-linux-gnu/libopenal.so 
-- Found VORBIS: /usr/include 
-- Sound enabled.
-- checking for module 'freetype2'
--   found freetype2, version 17.1.11
-- Found Freetype: /usr/lib/i386-linux-gnu/libfreetype.so (found version "17.1.11")
-- Freetype enabled.
-- Found LuaJit: /usr/lib/i386-linux-gnu/libluajit-5.1.so

Re: [Linux] Is LUAJIT really working?

PostPosted: Mon Jun 06, 2016 21:04
by ExeterDad
I just now built 0.4.14 (server) and it linked to my libs just fine
+ Spoiler


Edit: Just did a pull from dev and it linked as well.
Is it possible you have the headers installed, but the libs are missing? Can you confirm libluajit-5.1.so is in your libs dir? Weird.

Re: [Linux] Is LUAJIT really working?

PostPosted: Tue Jun 07, 2016 15:23
by sfan5
With the ldd output you quoted your minetestserver would be completely non-functional.

libz.so is required for compressing MapBlocks when saving them to disk, libsqlite3.so is the default backend for saving MapBlocks and can't be disabled, libpthread.so is required for threading which is used by the minetest server and can't be removed either.

In short: Don't believe the ldd output and look at what CMake's saying.

Re: [Linux] Is LUAJIT really working?

PostPosted: Tue Jun 07, 2016 18:59
by kaeza
To see if you're running LuaJIT, create a dummy mod with this code:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
assert(jit)

If you're running under plain Lua, you'll get an "assertion failed!" error message.

Re: [Linux] Is LUAJIT really working?

PostPosted: Wed Jun 08, 2016 19:47
by JDCodeIt
Well I guess it is working.. I bracketed with log messages, and this was the output on the terminal.

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
2016-06-08 13:35:21: ACTION[Main]: assert(jit)
2016-06-08 13:35:21: ACTION[Main]: done with assert(jit)

Hard to imagine the lua performance without jit - really, 30 times slower? With reasonably setup technic and pipeworks systems, I regularly get the warning that ABM's are taking too long - like 600+ms (Xubuntu AMD A6-5200 quad-core @ 2.0 GHz, 8 GB RAM)