ldtk icon indicating copy to clipboard operation
ldtk copied to clipboard

Option to disable level json caching mechanism

Open parvit opened this issue 5 months ago • 3 comments

This PR fixes #1172.

When loading projects which are bigger than usual (~40 levels) the level json caching mechanism allocates a lot of memory and requires more than 4GB of memory, which blocks the editor.

The PR adds a new global ui option levelJsonCacheActive with default value true, that allows create/load these big projects by disabling the caching mechanism.

Included in the change also the UI change to handle the option in line with similar options in the UI already present.

Please review and send feedback.

parvit avatar Jul 18 '25 22:07 parvit

The big drawback with caching being disabled is that all save operations will require to rebuild JSON for each level even if it didn't really change. Maybe there's a better way to achieve good saving speed without caching 🤔

I will have a look to this when I will get back to ldtk.

deepnight avatar Jul 24 '25 17:07 deepnight

The big drawback with caching being disabled is that all save operations will require to rebuild JSON for each level even if it didn't really change. Maybe there's a better way to achieve good saving speed without caching 🤔

I will have a look to this when I will get back to ldtk.

Of course, let me know if you have a different approach in mind and i'll investigate it.

EDIT: I just thought of something, maybe keeping an internal level boolean that indicates if the level has changed and copy the json from the original file on save might be a better solution?

parvit avatar Jul 24 '25 19:07 parvit

I've just sent a different PR which i think might have a better approach without disabling the cache, #1185 .

parvit avatar Aug 05 '25 06:08 parvit