Page 1 of 1

Save and Load performace

Posted: Sat Oct 29, 2022 12:24 pm
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?

Re: Save and Load performace

Posted: Sat Oct 29, 2022 12:32 pm
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

Re: Save and Load performace

Posted: Mon Dec 05, 2022 4:19 pm
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.

Re: Save and Load performace

Posted: Mon Dec 05, 2022 4:34 pm
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

Re: Save and Load performace

Posted: Mon Dec 05, 2022 4:36 pm
by Alex
Thx, for your answer, ok I understood about keys, also I have added EDIT section to my post :)