How to reduce save and load times

Discussion and help for Easy Save 3
Vinily
Posts: 3
Joined: Fri Jul 31, 2020 8:59 am

How to reduce save and load times

Post by Vinily »

Hello there,

I am currently building an editor-game where users will be able to build up an object from scratch. Because I want to save and load that creation I was trying to just save the most parental gameobject where everything that is created by the user is being stored in and reload that when the user wants to continue.

My problem is that this "creation" will probably include thousands of different objects with different components, values and so on. I know that theoretically I can store everything by adding as many CustomTypes as I need, but my problem is that saving and loading this takes like forever. I tried saving 1000 children with 3 or 4 components attached and it took me like 10 minutes to save and more than 10 minutes to load. And my pc is top notch, so most of my users will wait even longer.
Is there any way to significantly increase save and load times?

I know that I could also iterate through all those children and write a complex method to save different objects in different files and then load the whole construct piece by piece and glue it back together. But since the creation will be extremely complex the "save and load" everything approach would be a lot more convenient.

Thanks a lot in advance!
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: How to reduce save and load times

Post by Joel »

Hi there,

We have a guide to improving performance here:
https://docs.moodkie.com/easy-save-3/es ... rformance/

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Vinily
Posts: 3
Joined: Fri Jul 31, 2020 8:59 am

Re: How to reduce save and load times

Post by Vinily »

Hey Joel,

thanks a lot for your answer. I used the Cache-method and saving- and loading-times improved insanely. I am able to save the object with all the children and components in a few seconds.

But now I am encountering a new problem: When I press my "load" button, unity is trying to load thousands of objects. This causes the app to crash since it is trying to load them all simultaneously. Is there a way to tell the ES3.Load / LoadInto - functions to load the content in a way that does not overcharge unity?

I appreciate your help.

Best regards,
Dennis
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: How to reduce save and load times

Post by Joel »

Hi Dennis,

There are three options here.

Option 1: You can either divide your data up into smaller pieces of spread multiple load calls over multiple frames (perhaps using a coroutine.

Option 2: You can try running Easy Save in a separate thread. However, although Easy Save is thread safe be aware that the data you're saving and loading might not be.

Option 3: Ensure that all of the data you're saving actually needs to be saved, and cut down the amount that you're saving.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
eotiti
Posts: 4
Joined: Wed Dec 28, 2016 5:46 am

Re: How to reduce save and load times

Post by eotiti »

I also load a lot of objects and I am having the same problem ...save game very fast . But the load game is quite slow and it make my game .exe being not responding. :shock:

I don't know if this is because Easysave is running slowly or unity which initializes the object on load takes a long time
Please explain it to me!
And please give me a way to make the game loading faster and not be (not responding)
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: How to reduce save and load times

Post by Joel »

Hi there,

In order to work out what is causing the slowdown you will need to profile your project using Unity's profiler. In particular you should use Deep Profile to understand what method in particular is causing the slowdown. More information on Unity's Profiler can be found in their docs:
https://docs.unity3d.com/Manual/Profiler.html

If you haven't already done so you should also follow the Improving Performance guide here:
https://docs.moodkie.com/easy-save-3/es ... rformance/

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
eotiti
Posts: 4
Joined: Wed Dec 28, 2016 5:46 am

Re: How to reduce save and load times

Post by eotiti »

Hi Joel !

I have found the cause of this problem ... easysave loaded a lot of data at the same time when I first entered the game.
The loaded data are objects within the game
like when you create 1000 trees in a forest at the same time ... this causes make unity stuck
before it can load 1000 new trees it needs to delete all the old trees previously saved ... so this will be slower
I understand that unity needs some time to remove and create new ... but need something to manage the data retention flow
Currently everything is work at the same time ... causing it to be stuck .. unity not responding....
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: How to reduce save and load times

Post by Joel »

Hi there,

If the issue is the amount of data you are loading, you will need to break the data down into separate files and load them across multiple frames, or reduce the amount of data you are loading.

Alternatively you can load the data asynchronously in a separate thread to spread it across multiple frames and prevent it from blocking the main thread.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
eotiti
Posts: 4
Joined: Wed Dec 28, 2016 5:46 am

Re: How to reduce save and load times

Post by eotiti »

Hi Joel

Does Easysave 3 improve data load times more than easysave 2?
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: How to reduce save and load times

Post by Joel »

Hi there,

Easy Save 2 does not have caching so will be slower than Easy Save 3. Easy Save 2 is only provided for legacy reasons, so we would not be able to provide support for it.

Just to confirm, have you followed the advice in my previous post?

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply