lua-users home
lua-l archive

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


Hi,

A while ago I decided to relearn some things I've long forgotten and implemented the Revised Simplex Method [1] in Lua.  I've now got around to implementing the exact same algorithm in C, and so can compare the performance of LuaJIT against C on workload that is, well, of interest to me, and might be of interest to others.

I ran the algorithm over a small set of netlib test problems, and the total times are:

Lua: 2967s
LuaJIT without ffi: 58.8s
LuaJIT with ffi: 45.9s
gcc 4.6.0 -O2: 43.2s  (O3 and -ftree-vectorize didn't seem to make it faster)

LuaJIT vs Lua: 50 or 64x faster
LuaJIT vs C: 6% slower

Only 6% slower than C is pretty impressive.

If anyone's interested the code is at [2].  The algorithm I've implemented is not in any way a modern version of the simplex method, so please don't use it to solve any LPs.


Cheers,
Geoff

[1] http://en.wikipedia.org/wiki/Simplex_algorithm
[2] http://github.com/geoffleyland/luasimplex