About Monkey 2 › Forums › Monkey 2 Programming Help › JSON Parse very slow
This topic contains 0 replies, has 1 voice, and was last updated by therevills 1 week ago.
Viewing 1 post (of 1 total)
-
AuthorPosts
-
February 28, 2019 at 7:48 am
therevills
ParticipantI’ve created a little map via PyxelEdit, it is 640×400 in size using 8×8 tiles (so 80×50) and I’m using 3 layers, I’ve exported it into JSON format and when trying to parse it is taking over a second:
Monkey12345[crayon-5c81dccaaefdb608847426 inline="true" ] Local json := LoadString("asset::levels/" + mapFileName + ".json")Local st:=Millisecs()jsonData = JsonObject.Parse(json)Local et:=Millisecs() - stPrint "JSON Parser took " + et + "ms"[/crayon]
Here is a subset of the JSON:
Monkey1234567891011121314151617181920212223242526272829303132[crayon-5c81dccaaefe1531124714 inline="true" ]{"tileshigh": 50,"tileheight": 8,"tileswide": 80,"tilewidth": 8,"layers": [{"tiles": [{"x": 0,"rot": 0,"y": 0,"index": 0,"tile": -1,"flipX": false},{"x": 1,"rot": 0,"y": 0,"index": 1,"tile": -1,"flipX": false},{"x": 2,"rot": 0,"y": 0,"index": 2,"tile": -1,"flipX": false},[/crayon]
If I export to XML and parse it via tinyxml it only takes around 300ms.
The JSON is pretty big though over 2MB in size, but even compressed its slow.
-
AuthorPosts
Viewing 1 post (of 1 total)
You must be logged in to reply to this topic.