lua-users home
lua-l archive

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


Very nice!

As Mac OS 10.6 user with Android phone (and iPad hehe) I'm very happy right now...

To get it compiling, I had to install (using mac ports, but brew, or others might help too) - "port install gcc452" - I chose 4.5.2 as it seems the latest stable gcc, and luajit wants 4.3+ (only 4.2 is installed by XCode 4).

First I had a problem of "Unknown something: .private extern" - can't remember the exact error, but now rereading this message, it came to me that I have to add TARGE_SYS=linux, and voila:

make HOST_CC="gcc-mp-4.5 -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF" TARGET=arm TARGET_SYS=linux

also my NDK env (changed linux-x86 to darwin-x86 for the cross platform compiler)

NDK=/Users/malkia/p/android-ndk-r5b
NDKP=/Users/malkia/p/android-ndk-r5b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin/arm-linux-androideabi-
NDKF=--sysroot /Users/malkia/p/android-ndk-r5b/platforms/android-8/arch-arm
NDKABI=8
NDKVER=/Users/malkia/p/android-ndk-r5b/toolchains/arm-linux-androideabi-4.4.3

Can't wait to try it out.

As always - awesome work!

Hmmm... I scratch my head thinking how close the ppc port is to xbox/ps3 - probably quite different, these last two being completely different "OS-s", and PS3 already has lua, based on the reference version, running on the SPE (SPU) chip

On 4/17/11 4:12 PM, Michal Kottman wrote:
Hi, I've noticed that Mike did a commit that enables the ARM/Android
port of LuaJIT2, and I was impatient to test it out on my (slow+cheap)
Pulse U8220 phone [1].

The compilation of LuaJIT2 was very straightforward, using the Android
NDK and the instructions given at doc/install.html

To compare it, I also compiled the standard Lua interpreter for Android.
In order to do that, I had to patch llex.c / trydecpoint and remove the
decpoint tricks [2], because locale support is missing from Android.
Then I modified the src/Makefile, modified the PLATS variable to include
"android" and added the following rule:

android:
	$(MAKE) all MYCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN $(NDKF)"
MYLDFLAGS="$(NDKF)" MYLIBS="-Wl,-E -ldl"

Then, I ran make using the same variables as for the LuaJIT build:

make CC="${NDKP}gcc" AR="${NDKP}ar rcu" RANLIB="${NDKP}ranlib"
NDKF="$NDKF" android

I compared the performance using scimark.lua [3], and here are the
results:

# lua -v
Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio

# time lua scimark.lua
Lua SciMark 2010-12-10 based on SciMark 2.0a. Copyright (C) 2006-2010
Mike Pall.

FFT         0.34  [1024]
SOR         0.78  [100]
MC          0.22
SPARSE      0.44  [1000, 5000]
LU          0.53  [100]

SciMark     0.46  [small problem sizes]

# luajit -v
LuaJIT 2.0.0-beta6 -- Copyright (C) 2005-2011 Mike Pall.
http://luajit.org/

# time luajit scimark.lua
Lua SciMark 2010-12-10 based on SciMark 2.0a. Copyright (C) 2006-2010
Mike Pall.

FFT         1.63  [1024]
SOR         4.38  [100]
MC          1.07
SPARSE      2.58  [1000, 5000]
LU          3.43  [100]

SciMark     2.62  [small problem sizes]


It looks like LuaJIT is 5x times faster than standard Lua on my phone
(if I understand the results correctly). For comparison, on my Core i3
M350 laptop I get a SciMark score of 12.55 for Lua, and 588.47 for
LuaJIT, so the difference is not as big, but it definitely is great to
have LuaJIT running on Android :)

[1] http://wiki.modaco.com/index.php/Huawei_U8220
[2] http://www.lua.org/source/5.1/llex.c.html#trydecpoint
[3] http://luajit.org/download/scimark.lua