IssueRaiser

Use an intermediate representation format for GDScript

### Describe the project you are working on The GDScript implementation. ### Describe the problem or limitation you are having in your project GDScript currently is compiled when loaded, even in a release build. There are a few problems with this approach: - It's slow to load scripts because it has to parse the script itself and all of its dependencies. - Since scripts are loaded individually, some script may have to be parsed multiple times as a byproduct of being a dependency of other scripts. - It requires more type information in the release builds to properly do all the checks and behave the same way as in debug. - It exposes plain text code of the project in the released game (see #4220). ### Describe the feature / enhancement and how it helps to overcome the problem or limitation An [intermediate representation](https://en.wikipedia.org/wiki/Intermediate_representation) (**IR** for short) is able to help solving those issues. - It allows compiled scripts to be stored, including on export. - Therefore, the exported project only needs to keep the IR version, not the original source code. - The IR doesn't need to be type-checked again, because that happened when producing it. So the release binaries can potentially be stripped of some type information. - The IR is similar to machine code and thus harder to read. - While it is not impossible to recreate a GDScript source from IR, some information is still lost like comments and names of local variables/parameters,

Posted by vnen on Dec 7, 2023, 2:15 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.2,000 issues0 comments

github (Other)

Use an intermediate representation format for GDScript

vnenDec 7, 2023, 2:15 PM

### Describe the project you are working on The GDScript implementation. ### Describe the problem or limitation you are having in your project GDScript currently is compiled when loaded, even in a release build. There are a few problems with this approach: - It's slow to load scripts because it has to parse the script itself and all of its dependencies. - Since scripts are loaded individually, some script may have to be parsed multiple times as a byproduct of being a dependency of other scripts. - It requires more type information in the release builds to properly do all the checks and behave the same way as in debug. - It exposes plain text code of the project in the released game (see #4220). ### Describe the feature / enhancement and how it helps to overcome the problem or limitation An [intermediate representation](https://en.wikipedia.org/wiki/Intermediate_representation) (**IR** for short) is able to help solving those issues. - It allows compiled scripts to be stored, including on export. - Therefore, the exported project only needs to keep the IR version, not the original source code. - The IR doesn't need to be type-checked again, because that happened when producing it. So the release binaries can potentially be stripped of some type information. - The IR is similar to machine code and thus harder to read. - While it is not impossible to recreate a GDScript source from IR, some information is still lost like comments and names of local variables/parameters,

Comments (0)

No comments yet. Start the discussion.

Comment on this issue