Because the interests me, I took a few minutes to try this out.
I ran this test on GCC 4.8.2-19ubuntu1, since it was the newest official release I could get my hands on without compiling my own GCC.
Here are my raw numbers (methodology below):
LuaJIT 2.0.2 (JIT disabled): 1.675s
Lua 5.1.5: 5.787s (3.45x)
Lua 5.1.5 w/FDO: 5.280s (3.15x)
Lua 5.1.5 -O3: 6.536s (3.90x)
Lua 5.1.5 -O3 w/FDO: 4.288s (2.56x)
For a benchmark I ran the fannkuch benchmark with N=11 (https://github.com/headius/luaj/blob/master/test/lua/perf/fa...).My machine is a Intel(R) Xeon(R) CPU E5-1650 0 @ 3.20GHz.
To test LuaJIT with the JIT disabled I ran:
$ time luajit -j off benchmark.lua
To test regular and FDO builds for Lua 5.1.5 I ran (in the "src" directory of a Lua 5.1.5 tree): $ make all
$ time ./lua benchmark.lua
$ make clean
$ make all MYCFLAGS=-fprofile-arcs MYLIBS=-fprofile-arcs
$ ./lua benchmark.lua
$ make clean (note: does not delete *.gcda)
$ make all MYCFLAGS=-fbranch-probabilities
$ time ./lua benchmark.lua
Because Lua's Makefiles use -O2 by default, I edited the Makefile to try -O3 also.> and file bugs about the differences in assembly generation
It would be pretty hard to file bugs that specific since the two interpreters use different byte-code.
It would be an interesting exercise to write a C interpreter for the LuaJIT bytecode. That would make it easier to file the kinds of performance bugs you were mentioning.