ToME: the Tales of Maj'Eyal

Everything about ToME
It is currently Sun Apr 23, 2017 9:55 am

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Tue Jun 04, 2013 6:45 am 
Offline
Thalore

Joined: Tue Feb 28, 2012 6:36 am
Posts: 148
For TE4 1.0.4, the program executable was reverted to the binaries compiled for the 1.0.1 release. The executables built for 1.0.2 through 1.0.4 run significantly slower that the ones for 1.0.1 and previous releases. I've recently been able to do some testing and found out some interesting things.

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:
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

So, we must fix two things to achieve better performance in the long run for t-engine. First is to determine why recent version of luajit2 runs so much slower than 2.0.0-beta8. Second is to find out where the rendering bottleneck is and either remove it or circumvent it (perhaps by switching to reduced FPS while resting). Alleviating both issues, according to rough measurements, would look to make resting five times as fast. That's a big quality of life improvement while playing a game of TOME.

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...


Top
 Profile  
 
PostPosted: Wed Jun 26, 2013 4:53 pm 
Offline
Thalore

Joined: Tue Feb 28, 2012 6:36 am
Posts: 148
Here's a patch which adds resting and running FPS dividers to t-engine. It additionally applies the running FPS divider to tome's autoexplore.

These dividers simply divide the game's requested FPS by their respective values while resting or running. They can be set under options->video options. Setting these dividers to something greater than one can substantially reduce the amount of time required to finish resting/running on older computers.

If you run t-engine at 30 FPS requested, I recommend setting the resting divider to 15 (2 FPS while resting) and running divider to 5 (6 FPS while running/autoexploring). Just be careful when resting on an escort mission...


Top
 Profile  
 
PostPosted: Thu Jul 11, 2013 6:39 am 
Offline
Wyrmic

Joined: Thu May 23, 2013 12:25 am
Posts: 244
This is fantastic work. Even on my reasonably well powered system, resting times and explore times are vastly improved.

I hope DarkGod implements this asap!

_________________
Please help with the ToME wiki!


Top
 Profile  
 
PostPosted: Sat Jul 13, 2013 12:52 am 
Offline
Thalore

Joined: Tue Feb 28, 2012 6:36 am
Posts: 148
I made a tome addon which incorporates and improves upon the patch I linked to in my last post. It should work for both 1.0.4 and the current git code.

[1.0.4] Faster Run/Rest/Explore

Anyway, I'm glad to hear the patch works well for you!


Top
 Profile  
 
PostPosted: Sat Jul 13, 2013 2:20 pm 
Offline
Archmage

Joined: Tue Nov 11, 2003 10:54 am
Posts: 379
Location: Wroclaw/Poland
I agree,

This patch is a godsend (pun not intended). It makes the latest git version playable again :)

Cheers and many thanks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group