The Cave > General Discussions > Topic Details
chriskringel Apr 21, 2013 @ 4:48pm
Small but nice performance tweak for Linux
Recently I was discovering some stuttering playing "The Cave". I haven't had this behaviour before. Maybe it's my system configuration, maybe not. Doing research I discovered a nice tweak.

1.) Changing the scheduler from "cfq" to "deadline". It helps both with HDDs and SSDs.

echo deadline | sudo tee /sys/block/sda/queue/scheduler
(where sda is your primary drive. it may vary on your system! see: ls /dev/sd* )

2.) Changing priority (needs the schedtool package to be installed):
Start "The Cave", switch to a terminal and type:

sudo schedtool -v -F -p 15 -n -4 -a 0x1 `pgrep Cave.bin.x86`

If you can't switch to any terminal window during the game is running (e.g. via your window manager's Alt+Tab) you can type this command in a terminal window before launching "The Cave". e.g.:
sleep 15; sudo schedtool -v -F -p 15 -n -4 -a 0x1 `pgrep Cave.bin.x86`
And then just quickly start the game.
(however make sure that the sudo timestamp hasn't expired! you can do check it with something like "sudo <some random command>" e.g. "sudo true")


Some distributions provide also the package schedtoold. Then you can just edit your /etc/schedtoold.conf once! Something like: Cave.bin.x86 -F -p 15 -n -4 -a 0x1 And depending on HT or how many cores your system have, you might want to play with or remove the "-a 0x1" option. See the link #2 below.


That's it!

Credits:
1.) http://askubuntu.com/questions/78682/how-do-i-change-to-the-noop-scheduler
2.) https://wiki.archlinux.org/index.php/Gaming#General_case
https://wiki.archlinux.org/index.php/Gaming#Core_affinity

PS:
You can also test switch display Hz rates in the game's settings. Choose the highest rate available. Otherwise play with the setting. For me it sometimes works better so select "60Hz" instead of "75Hz". Most of the time with "75Hz" though.

My system:
AMD 2.2GHz San Diego Single Core (from mid 2005)
Ubuntu 13.04 (64bit)
Nvidia GeForce GT 520
Game settings: 1024x768 with FXAA, SOAA, Bloom, Depth of Field, High Quality Effects, etc. enabled. SSAA disabled. Vsync on.
Last edited by chriskringel; Apr 21, 2013 @ 4:53pm