Extremely slow

Discussion and help for Easy Save 3
Post Reply
caduceus
Posts: 15
Joined: Tue Nov 02, 2021 12:23 pm

Extremely slow

Post by caduceus »

How I can making saving and loading more faster?
This is absolutely, extremely slow. VERY SLOW! Each my scene saving more than 1 minute. 1 minute!!!! This is absolutely impossible.

Is EasySave packing-unpacking each time after each ES3.Save calling?

For example next code:

ES3AutoSaveMgr.Current.Save();
ES3.Save("mesh1", mesh1);
ES3.Save("mesh2", mesh2);
ES3.Save("mesh3", mesh3);

Is this code compress-uncompress after each line of code?

How I can making this code more faster?
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Extremely slow

Post by Joel »

Hi there,

Firstly I recommend following the Improving Performance guide:
https://docs.moodkie.com/easy-save-3/es ... rformance/

However, if saving and loading is slow because your meshes are large, then this would be limited by your hardware and OS rather than at our end, because saving large amounts of data is inherently slow. You may be able to call your save and load code in a separate thread so that it doesn’t block the main thread and cause freezing, but this wouldn’t decrease the time it takes to save.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
caduceus
Posts: 15
Joined: Tue Nov 02, 2021 12:23 pm

Re: Extremely slow

Post by caduceus »

Thank you

But I am afraid reason not in hardware. Reason in JSON for binary data.
Human readable - this is single priority of JSON. For binary data JSON absolutely impossible.

Not exist image format, where each pixel color saving in JSON structure. Saving meshes in JSON - this is like saving pictures in JSON
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Extremely slow

Post by Joel »

Hi there,

It's a misconception that binary serialization is inherently more compact than other methods; it's actually the unstructured nature of BinaryWriters/Readers which makes it more compact. As Meshes are structured data, you wouldn't be able to store these in an unstructured/sequential way without writing your own protocol to manage this (which would be inflexible, hard to maintain and proprietary).

If you want to write data in an unstructured way, you would need to use a BinaryReader/Writer to do this yourself and define your own format. This would be outside the scope of Easy Save, which is for serializing structured data.
Not exist image format, where each pixel color saving in JSON structure. Saving meshes in JSON - this is like saving pictures in JSON
This analogy is incorrect. Even if you used unformatted binary, you would still save each vertex/triangle/etc individually. Saving an image is smaller because it uses compression (i.e. JPG).

You can use compression when saving a Mesh with Easy Save by following the instructions here:
https://docs.moodkie.com/easy-save-3/es ... ompression

However, if the slow performance is because of the serialization process like you suggest, this will actually slow things down rather than speed it up. All compression does is decrease the file size, it doesn't speed up the process (quite the opposite).

Note that I speak out of experience here. Both Easy Save 1 and 2 used binary formatting. They were no faster at storing structured data than Easy Save 3, and much less debuggable/maintainable.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
caduceus
Posts: 15
Joined: Tue Nov 02, 2021 12:23 pm

Re: Extremely slow

Post by caduceus »

OK, thank you, I will try
Post Reply