Jump to content

Saving Disk Space and Loading times on MacOS


Lisias

Recommended Posts

This one is so obvious that I'm a bit ashamed of myself for just noticing it now. :D 

That's the history: my loading times are getting terrible as KSP evolves. New hires textures and maar parts are imposing a toll on my rig.

Of course, using a SSD is a nice compromise, but these things are still expensive around here - and I since I have every single KSP version released on a test bed on my development rig, I would need a really expensive one.

So, while researching the new APFS deduplication facilities (ie, "Copy on Write"), I realised that APFS (and HPFS+ too!!) have transparent file compression support! It just happens that Apple, for reasons only reachable by the Krakens, never cared to write GUI support for it! To tell you the true, they barely wrote tools at all - there's ditto , and that's all.

Since KSP files are highly compressible, that would solve some problems: disk space on SSDs and loading times on hard disks. But how to compress the files on a living installment? Well, fortunately someone had solved it for us, the answer is afsctool . If you are adventurous, you can compile and use this sensibly more powerful fork.

Apple should had included something like this since Sierra, but... (sigh)

The good news is that MacPorts and Brew have it for easy installing by using one of the following commands:

sudo port install afsctool
-- or --
sudo brew install afsctool

The bad news is that you will need to mess with the command line to activate the compression.  :/ Well, it could be worse.

So, the following command will search for every GameData subdirectory from your home directory and compress it:

find ~ -type d -name "GameData" -exec afsctool -c -v -9 {} \;

This will take some time, execute the command line and go to the bed, leave the computer working by the  night.

This will compress only the GameData contents on your KSP installments, as this is where the really space eaters and loading times guzzlers are. Of course you can compress the whole shebang (I did just to see what happens), but the extra savings are not that great and compressing savegames will make savings and quicksavings a bit more expensive on CPU without significative savings on space and disk accesses.

There's a tradeoff, of course. You will "waste" one CPU core on every disk access, as the data must be decompressed before use. However, most of the games do access disk files for assets in need to be used, freezing the game on the process - so the CPU is not exactly needed at this time, and the savings on disk access more than worth the stunt: my loading times halved (at worst cases!!) on every game I activated the compression on (not only KSP!) - not to mention the 100GB disk space I earned back to install moar add'ons! :D 

Spoiler

 

p.s.: if you really want to compress the whole shebang, the command should be:


find ~ -type d -name "KSP.app" -exec afsctool -c -v -9 {}/.. \;


 

If you ever feel the need to uncompress the files, switch "-c" for "-d" on the command lines above - but be sure you have the needed disk space.

Merry Christmas.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...