Save and Load performace

Discussion and help for Easy Save 3
Post Reply
Alex
Posts: 6
Joined: Sat Oct 29, 2022 12:14 pm

Save and Load performace

Post by Alex »

I have save object A which have children B and C, and C have D and so on. And all classes have tens of fields

I am using

Code: Select all

a = ES3.Load("A", new A());
(and then I can access a.c.d.somefield)

I am curious whats work faster, if i made 1 write or read with lot of data, or should i separate all A, B, C, D and call

Code: Select all

a = ES.Load("A", new A());
b = ES.Load("B", new B());
c = ES.Load("C", new C());
...
separately?
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Save and Load performace

Post by Joel »

Hi there,

Fewer keys are generally quicker, so the first would be quicker. However, if you use caching as described in the Improving Performance guide then the difference becomes neglible.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Alex
Posts: 6
Joined: Sat Oct 29, 2022 12:14 pm

Re: Save and Load performace

Post by Alex »

Thanks, for your answer.

I have related question about 1 key or several key. I am used to do like that:
SaveData saveData = new();

then in SaveData i have:
PlayerSaveData and EquipmentSaveData.

and when I load game, I load all my save into SaveData object. When you answered that fewer keys are quicker, I haven't change my solution.
But now I am back. Because I want to make reset data functionality, but I want to delete or player data or equipment data only.

I found this one: https://docs.moodkie.com/easy-save-3/es ... deletekey/ and how I understand it possible to delete only Root key of all structure.

Question: is it possible to delete nested keys (e.g. DeleteKey("saveData.playerData", "savefile") ? or I should separate: { "playerdata": {}, "equipmentData": {} } to delete only part of my save data

EDIT: hmm, I just realized, that probably its not necessary to have possibility to delete nested key, because i can access my data saveData.playerSaveData.Clear() or =new() and then save.
Last edited by Alex on Mon Dec 05, 2022 4:35 pm, edited 1 time in total.
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Save and Load performace

Post by Joel »

Hi there,

PlayerSaveData and EquipmentSaveData aren’t keys, they’re objects stored in fields of an object you’re saving. You would need to save these to separate keys if you want to delete them.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Alex
Posts: 6
Joined: Sat Oct 29, 2022 12:14 pm

Re: Save and Load performace

Post by Alex »

Thx, for your answer, ok I understood about keys, also I have added EDIT section to my post :)
Post Reply