[Linux] Reducing loading time

rkfgrkfg Russia Join Date: 2013-09-03 Member: 187744Members, Reinforced - Supporter, Reinforced - Silver, Reinforced - Gold, Reinforced - Diamond, Reinforced - Shadow
Just a hint from a fellow NS2 player which I tested myself. And it works, probably. Before, I was loading for about 1 min 20 seconds joining a server with mods. Now it's like 37 seconds. Quite the difference, huh? So, what's the magic behind it? It's btrfs filesystem. It's better optimized for big directories (i.e. those with many files, like thousands of them) and as such has less seek times. Even on SSDs where seek time is small but a directory is technically a file that contains a list of other files and directories. It should be read entirely to traverse the path further.

So, you can convert your drive to btrfs with btrfs-convert /dev/sda1 (for example) and if it somehow won't satisfy you, you can later do btrfs-convert -r /dev/sda1
Though you'll lose any changes you did after the conversion, i.e. it will be restored to the state you had right before conversion. Make backups first anyway and use UPS. Btrfs can probably be considered stable, it has lots of advanced features (compared to the traditional FS like ext4) and looks like it's much faster when you need to read many little files.

For this to work you should use btrfs on all drives that are involved in the game loading process. For example, if your home directory is on one drive (HDD) and Steam is on another one (SSD), it's better to create a new user on SSD so its home directory is also there. Even if you symlink or mount --bind "~/.config/Natural Selection 2" to SSD, it doesn't seem to help.

Of course, you may just cut a bit of your SSD for btrfs and put Steam+NS2+new user there. It can be done with any bootable system like SysRescueCD. Btrfs can't be used as a boot partition though so you have to use a separate ext2 partition for /boot. Most configurations already use such layout but just in case.

You can also resize btrfs partition without unmounting it and it's done immediately. So give it a try.

Comments

  • YojimboYojimbo England Join Date: 2009-03-19 Member: 66806Members, NS2 Playtester, NS2 Map Tester, Reinforced - Supporter, Reinforced - Silver, Reinforced - Shadow
    Just wanna say congratulations on becoming the latest CDT member @rkfg #congrats #squishthosebugs #fixonoscameltoe #optimizens2 #loveyouman
  • rkfgrkfg Russia Join Date: 2013-09-03 Member: 187744Members, Reinforced - Supporter, Reinforced - Silver, Reinforced - Gold, Reinforced - Diamond, Reinforced - Shadow
    edited February 2015
    What? I'm not a CDT member, just helping. I haven't even applied. I doubt I can sign an NDA (so it has a legal effect) being a Russian citizen with all this poitical bullshit going on.

    And btw, this isn't a bugfix, it's a workaround outside NS2. The real fix is probably coming in build 275 if they'll mark non-existing files in mods folders so there would be less filesystem scans. This would reduce loading times for Windows players as well.
  • YojimboYojimbo England Join Date: 2009-03-19 Member: 66806Members, NS2 Playtester, NS2 Map Tester, Reinforced - Supporter, Reinforced - Silver, Reinforced - Shadow
    Hahaha I know I'm joking with you my big russian bear, they should have you on board though, been a massive help past week.

    Yes this would be a lovely improvement for windows players!
  • AsranielAsraniel Join Date: 2002-06-03 Member: 724Members, Playtest Lead, Forum Moderators, NS2 Playtester, Squad Five Blue, Reinforced - Shadow, WC 2013 - Shadow, Subnautica Playtester, Retired Community Developer
    the cdt is always open to any new members, but for the work rkfg has been done until now there is no special need to be part of any structure. being in the cdt means mostly that you have to handle playtesting and actual development of the game. a first step would be to become a playtester, which is where rkfg might fit better with his work.

    Regarding the topic, interesting find. The next build will actually contain a functionality that should slightly help with loadtimes on linux, probably related to what you observed.
  • METROIDMETROID Join Date: 2012-10-31 Member: 165171Members, Reinforced - Supporter
    @Yojimbo, if you love @rkfg that much, you can nominate him for "Squad Five" in the Hall of Fame Thread
Sign In or Register to comment.