Recent builds of T-Engine have used LuaJIT2 2.0.1. The TE4 1.0.1 release uses LuaJIT2 2.0.0-beta8. After reverting several commits to t-engine's C code base and recompiling, it became pretty clear that this upgrade to luajit2 has been causing most of the slowdown. Recompiling with luajit2 2.0.0-final exhibited the same symptoms. It appears something changed with luajit2 starting with 2.0.0-beta9 that causes t-engine to run much slower relative to luajit2 2.0.0-beta8.
While testing out the performance of each luajit2 library, I noticed another interesting thing. Under win32, while resting, it takes significantly less time to finish resting when the in-game FPS is lowered. For users with an older computer or weak graphics card, TOME 1.0.2 must have been infuriating to play.
Here are some rough performance comparisons. More that one test was run per configuration, but testing was not exhaustive. To generate the numbers, I created an arcane blade in TOME in cheat mode, enabled semi-godmode, teleported to elven ruins level 3, found a spot where some monsters could sense me but not interrupt resting, and finally set my max mana to 4000. For each configuration, I then drained my mana to zero and measured the amount of time to restore to full via resting.
Code: Select all
column header abbreviations
TTR4KM Average time to regen 4k mana (approx, in s)
SR-Trunk Speedup relative to TE4-Trunk w/ luajit2-2.0.1
SR-R-FPS60 Speedup relative to respective TE4 build at FPS=60
SR-R-Trunk-FPS60 Speedup relative to TE4-Trunk w/ luajit2-2.0.1 at FPS=60
config abbreviations
1.0.1 TE4-1.0.1 with luajit2-2.0.0-beta8
Trunk-b8 TE4-trunk with luajit2-2.0.0-beta8
Trunk TE4-trunk with luajit2-2.0.1
note: TE4-Trunk C code corresponds to svn 6642
FPS=5
TTR4KM SR-Trunk SR-R-FPS60 SR-Trunk-FPS60
1.0.1 40 1.68 1 1.68
Trunk-b8 45 1.49 1 1.49
Trunk 67 1 1 1
FPS=60
TTR4KM SR-Trunk SR-R-FPS60 SR-Trunk-FPS60
1.0.1 11.8 2.67 3.81 5.68
Trunk-b8 11.7 2.69 3.42 5.73
Trunk 31.5 1 2.13 2.13
Update: I've found the luajit2 commit which causes a slowdown in t-engine4's execution. The offending commit is located here. By specifically reverting this commit, we can run trunk luajit2 2.0.x at the same speed of execution as 2.0.0-beta8. Now to find out exactly why this commit affects t-engine's performance so much...