Lag during autosave

Post all other topics which do not belong to any other category.
Post Reply
User avatar
cpy
Filter Inserter
Filter Inserter
Posts: 839
Joined: Thu Jul 31, 2014 5:34 am
Contact:

Lag during autosave

Post by cpy »

Is there any way to reduce lag during autosave? Any ideas?

bulldog98
Long Handed Inserter
Long Handed Inserter
Posts: 74
Joined: Tue Apr 08, 2014 6:40 am
Contact:

Re: Lag during autosave

Post by bulldog98 »

<sarcasmon>Save in an Ramdisk.<sarcasmoff>

User avatar
cpy
Filter Inserter
Filter Inserter
Posts: 839
Joined: Thu Jul 31, 2014 5:34 am
Contact:

Re: Lag during autosave

Post by cpy »

I'm already saving to ramdisk. It's not helping.

FishSandwich
Smart Inserter
Smart Inserter
Posts: 1847
Joined: Sun Feb 23, 2014 3:37 pm
Contact:

Re: Lag during autosave

Post by FishSandwich »

You could always turn off autosave and just save when you feel it's necessary.

User avatar
DerivePi
Filter Inserter
Filter Inserter
Posts: 505
Joined: Thu May 29, 2014 4:51 pm
Contact:

Re: Lag during autosave

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

User avatar
cpy
Filter Inserter
Filter Inserter
Posts: 839
Joined: Thu Jul 31, 2014 5:34 am
Contact:

Re: Lag during autosave

Post by cpy »

Autosave saved my work a lot of times. I guess i'll have to get better at planning :D

NicoH
Manual Inserter
Manual Inserter
Posts: 3
Joined: Sun Aug 17, 2014 1:09 am
Contact:

Re: Lag during autosave

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

User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: Lag during autosave

Post by Adil »

You know you can change the interval between the autosaves in options, right?
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.

FishSandwich
Smart Inserter
Smart Inserter
Posts: 1847
Joined: Sun Feb 23, 2014 3:37 pm
Contact:

Re: Lag during autosave

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

User avatar
cpy
Filter Inserter
Filter Inserter
Posts: 839
Joined: Thu Jul 31, 2014 5:34 am
Contact:

Re: Lag during autosave

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

SilverWarior
Filter Inserter
Filter Inserter
Posts: 559
Joined: Mon Mar 04, 2013 9:23 am
Contact:

Re: Lag during autosave

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

User avatar
cpy
Filter Inserter
Filter Inserter
Posts: 839
Joined: Thu Jul 31, 2014 5:34 am
Contact:

Re: Lag during autosave

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

Post Reply

Return to “General discussion”