Page 1 of 1
Lag during autosave
Posted: Tue Aug 19, 2014 3:58 pm
by cpy
Is there any way to reduce lag during autosave? Any ideas?
Re: Lag during autosave
Posted: Tue Aug 19, 2014 4:03 pm
by bulldog98
<sarcasmon>Save in an Ramdisk.<sarcasmoff>
Re: Lag during autosave
Posted: Tue Aug 19, 2014 4:08 pm
by cpy
I'm already saving to ramdisk. It's not helping.
Re: Lag during autosave
Posted: Tue Aug 19, 2014 4:34 pm
by FishSandwich
You could always turn off autosave and just save when you feel it's necessary.
Re: Lag during autosave
Posted: Tue Aug 19, 2014 4:43 pm
by DerivePi
FishSandwich wrote:You could always turn off autosave and just save when you feel it's necessary.
Unfortunately, I usually think it is necessary to save just after I needed to
Re: Lag during autosave
Posted: Tue Aug 19, 2014 4:53 pm
by cpy
Autosave saved my work a lot of times. I guess i'll have to get better at planning
Re: Lag during autosave
Posted: Tue Aug 19, 2014 10:28 pm
by NicoH
Ah, so it's autosave. I already wondered what freezes my game every few minutes. I already play the game on a SSD, so I don't want to know how long it'd take to save to an hdd.
Re: Lag during autosave
Posted: Tue Aug 19, 2014 10:35 pm
by Adil
You know you can change the interval between the autosaves in options, right?
Re: Lag during autosave
Posted: Tue Aug 19, 2014 11:20 pm
by FishSandwich
NicoH wrote:Ah, so it's autosave. I already wondered what freezes my game every few minutes. I already play the game on a SSD, so I don't want to know how long it'd take to save to an hdd.
I play it on a HDD and the freeze ups take a fraction of a second. The files are tiny most of the time(less than 20mb) so I don't think it's anything to do with whether it's HDD or SSD but the compression process(since it zips the file) that slows it down. Most likely the game is waiting for the compression process to finish before it can continue.
I remember a dev saying a while ago that they were going to put the autosave process on another thread so that autosaving was more seamless. I guess we'll just have to wait for that.
Re: Lag during autosave
Posted: Wed Aug 20, 2014 6:43 am
by cpy
Saves are worse as your map is getting bigger. I start with 2 min, when i explore more and more i increase autosave interval to 4 - 5 - 10 - 20 - 30mins, because it gets only worse.
Re: Lag during autosave
Posted: Wed Aug 20, 2014 8:32 am
by SilverWarior
I don't think that the main reason why it takes so much time for saving game are the HDD or SSD speeds. I belive that the main reason for this is the way how Factorio currently handles ingame data.
When you have a static sized map you usually store all the map data in one data block so saving that data into savegame only requires one call "save that data block into a file".
But when you have practically infinite map split into multiple chinks then each of those chuks is saved into its own data blocks. So when you are saving such map into savegame you must call "save that data block into a file" so many times as you have the number of map chunks. And this slows down the process considerably especially if you are writing these data blocks directly into a savegame file.
That is a bit similar as copying bunch of small files versus one large file even thou combined size of those small files is same as the size of large file. Of course Factorio doesen't open and close the file handle for each block (this is pretty slow process) but still this is loswer that it would be if the whole savegame file was composed in the memory and then written as a whole. Why?
When you are writing small block of data into sime file you might not be making full use of HDD's or SSD's chache but when you are writing bug blocks of data into a file the HDD's or SSD's chahce is fully utilized.
So based on everything that I wrote it would be best if Factorio would compose entire savegame inside the memory first and then write it on the HDD or SSD in seperate thread. But the problem with this is that in order for you to be able to fully compose the savegame inside the memory you first need to have enough memory available. ANd this could cause Factorio not to work any more on some low end computers becouse its memory requirements would increase. Also you need to have a falback mechanizm which would be used when the game doesen't have nough memory for building whole savegame inside the computers memory. And this presents the problem that due to the Factorio map to be of dynamic size you practically can't know for sure how much memory would you require.
Re: Lag during autosave
Posted: Wed Aug 20, 2014 8:53 am
by cpy
Maybe put option to use experimental save feature? Provided there will be some crazy fast mechanic to save without even a slightest lag. I have lot of ram so no problem.