iebb / PalworldSaveEditor

Palworld Save Editor (in-browser)
MIT License
42 stars 6 forks source link

LosslessJSON very slow compared to native JSON #4

Open trumank opened 9 months ago

trumank commented 9 months ago

Doing crude benchmarks by just observing the "deserialize" time in the console, LosslessJSON seems to take about twice as much time as native JSON.

Another interesting observation: Firefox is significantly faster than Chome and taking about 30% of the time.

iebb commented 9 months ago

LosslessJSON is only used to preserve Int64 numbers. JSON encoding itself does not use too much time comparing to the parsing of the Gvas I think;

I'm unsure if there are any usages of Int64 outside of timestamp which is (or could pratically be) larger than 2^53, and if there's none I'm considering switching back as the error is less than 0.05ms.

trumank commented 9 months ago

Using native JSON cut the time down from about 15 seconds to 7 seconds for me on Chrome.

LosslessJSON is only used to preserve Int64 numbers

Ah that makes sense. They could be serialized as strings to preserve precision.