Open xsebek opened 1 month ago
This may actually be a good application for the (heretofore mythical) ToJSONE
. I just want to make sure we avoid doing $O(n^2)$ work to repeatedly check the same definitions for equality.
I think even $O(n^2)$ would be OK, since it would remove exponentially many inner references.
Outputting JSON is not done on main thread, so it would not freeze the game.
Good point. Yes, we should not succumb to premature optimization here. Let's start with the simplest thing that works and we can optimize it later if necessary.
Is your feature request related to a problem? Please describe.
TLDR: the problem is that
_envVars
inside_envVars
cause exponential JSON size.Take this simple example:
This makes it impossible to get to other useful parts of robot JSON, like the log, if the program has enough definitions:
2106
Describe the solution you'd like
The definitions should be reused - the inner references should link (
{"link": "m8"}
) to outer definition.If we can check that the definitions are the same, we could prune them from inner scope:
Describe alternatives you've considered
The current derived instance is broken, so maybe we could only keep the top environment, or none at all.