lua-users home
lua-l archive

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


** Previous timing for target-toy-native & target-toy-jit are wrong. **
** So, the results are opposite **

After reading this post
http://indefinitestudies.org/2010/02/08/creating-a-toy-virtual-machine-with-pypy/
and the referenced paper
http://codespeak.net/pypy/extradoc/talk/Ficooolps2009/bolz-tracing-jit.pdf
.

I try to compare LuaJIT 2 and PyPy JIT, so I port the same toy
interpreter in Lua (toy.lua)
with the same application which computes the square of the accumulator.
And I write too a pure Python version without any PyPy stuff (toy.py)
and C version (toy.c).

I obtain the following results :
the compilation of target-toy-native needs 47s (size ~ 120kb).
the compilation of target-toy-jit needs 571s (size ~ 2Mb).

time python target-toy.py 1000000
	real 41.777s
time target-toy-native 1000000
	real 0.060s
time target-toy-jit 1000000
	real 0.013s
time python toy.py 1000000
	real 7.860s
time lua toy.lua 1000000
	real 3.853s
time luajit toy.lua 1000000
	real 0.355s
time ./toy 1000000
	real 0.145s
	real 0.068s (when compiled with gcc -O2)

These tests are done on Ubuntu 9.10 (x86) with :
- gcc 4.4.1 (Ubuntu package)
- lua 5.1.4 (Ubuntu package)
- luajit 2 head
- python 2.6.4 (Ubuntu package)
- pypy trunk

Lua is faster (2x) than Python.
PyPy/C is comparable with gcc -O2, and faster (6x) than LuaJIT 2.
PyPy/JIT is faster (25x) than LuaJIT 2.
But LuaJIT doesn't need compilation stage.

François