Scirra / Construct-feature-requests

A place to submit feature requests and suggestions for Construct.
https://www.construct.net
11 stars 1 forks source link

JSON object scripting interface, getting data copy is bottleneck with large JSONs #361

Open F3der1co opened 1 month ago

F3der1co commented 1 month ago

Reviewed guidelines

Checked for duplicate suggestions

Summary

the JSON objects scripting interface doesn't allow us any direct access to the json data it holds, we have to get a copy of the data to access it. With large JSON files this creates a large performance bottleneck

Possible workarounds or alternatives

handle the JSON in scripting and expose getters and setter via event sheet return functions. (i.e. don't use the JSON objectType but recreate it)

Proposed solution

A way to directly access it (the Dictionaries scripting interface seems to allow that). As a worse alternative: getter and setter scripting interface where you can pass in a path.

Why is this idea important?

For projects that use events and scripting together the JSON object is a great way to pass data between the two paradigms.

Additional remarks

It's super weird how the JSON, Dictionary and Array scripting interface follow completely different patterns.

F3der1co commented 1 month ago

As a proof of the issue here is a Construct project with a 250kb json file, see CPU performance. jsonBottle.zip