Important change: Memory parsing

Starting from October 26, 11:00 UTC, the Memory object parsing will run inside a game script upon accessing the global variable Memory for the first time, and not on the server side before the script launches, as before. It means that the CPU cost on executing JSON.parse will be counted as your script expense.

This change will mostly affect those players who use Memory to store large amounts of small objects that require a long time to parse. Optimizing Memory structure instead of merely saving its volume will now become an essential part of the game process.

You may use the following code to check how much time your current Memory structure parsing takes:

var stringified = JSON.stringify(Memory);
var startCpu = Game.getUsedCpu();
JSON.parse(stringified);
console.log('CPU spent on Memory parsing:', Game.getUsedCpu() - startCpu);

Also, we are going to allow using raw Memory data as a string object, in case if you want to implement your own serializer/deserialzer instead of JSON.

Have more questions? Submit a request

Comments

Powered by Zendesk