Concerns about the performances of ES3.

Discussion and help for Easy Save 3
Post Reply
XeNoTimE
Posts: 1
Joined: Sun Mar 18, 2018 5:51 pm

Concerns about the performances of ES3.

Post by XeNoTimE »

Hello,

I did a quick test to compare ES2Writer.Write (sequentially without tag) with ES3File.Save.
All settings are configured to default.
My first results are particularly bad. ES3 seems 10X slower than ES2.

Here is a sample code (Results on my PC => ES2 : about 15ms, ES3 : about 150ms)

Code: Select all

using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using UnityEngine;

public class testSaves : MonoBehaviour 
{
	void Start () 
	{
		// ES3 Save ********************************************

		ES3File file = new ES3File("myFile.es3");	

		Stopwatch codeTimer = new Stopwatch();
		codeTimer.Start();

		for (int i = 0; i < 1000; i++)
		{
			file.Save<Transform>("myGUID", transform);
			//file.Save<string>("myGUID", "string test");
		}

		file.Sync();

		codeTimer.Stop();
        UnityEngine.Debug.Log("Time taken to save the Transform with ES3 : " + codeTimer.ElapsedMilliseconds);

		
		// ES2 Save ********************************************

		ES2Writer writer = ES2Writer.Create("myFile.txt");

		codeTimer.Reset();
		codeTimer.Start();

		for (int i = 0; i < 1000; i++)
		{
			writer.Write(this.transform);
			//writer.Write("string test");
		}

		writer.Save(false);

		writer.Dispose();

		codeTimer.Stop();
        UnityEngine.Debug.Log("Time taken to save the Transform with ES2 : " + codeTimer.ElapsedMilliseconds);		
	}

}
In my game such performances are not acceptable.
I have to save a lot of components (transform, audioSource, sprites, rigidbodies, colliders, tags, layers, custom components, other assets components ...).
I can save almost anytime and I want to avoid any lag.

Currently, I have relatively good performance using a customized version of ES2UniqueID and sequentially writing my data (ES2Writer.Write <T> (T data)).

I wanted to move to ES3 to take advantage of some new features and especially to ensure support and its compatibility with future versions of Unity.

My question is the following.
Is it planned to have in ES3 a sequential writing as efficient as in ES2?

Thank you in advance for your answer.

Best regards.

Guillaume (a french guy - sorry for my poor english)
User avatar
Joel
Moodkie Staff
Posts: 4871
Joined: Wed Nov 07, 2012 10:32 pm

Re: Concerns about the performances of ES3.

Post by Joel »

Hi there,

Easy Save 3 is much more flexible than Easy Save 2 as we now use JSON, but this no longer allows us to write sequentially.

If you need to write sequentially you can continue to use Easy Save 2, as this will be supported for the foreseeable future.

If there's enough demand for it we might at a custom binary formatter which will provide performance benefits, and there's a feature request for this here:
http://www.moodkie.com/forum/posting.ph ... 214&p=3854

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