goboscript icon indicating copy to clipboard operation
goboscript copied to clipboard

Reduce number of temporary variables emitted by code generation

Open aspizu opened this issue 1 year ago • 4 comments

Currently, for each function call, one temporary variable is emitted. This affects the load time of the project in Turbowarp which hinders the dev workflow.

aspizu avatar Jan 24 '25 18:01 aspizu

Can you elaborate on that? What is a "temporary variable" in this context?

Bituvo avatar Jan 24 '25 19:01 Bituvo

Each function call emits a variable named __callsiteN__ where N is a integer. It's set to the __funcName_return__ variable after calling the function procedure.

aspizu avatar Jan 24 '25 19:01 aspizu

Callsite vars only really need to be made if the function being called is used twice in the same 'line' of gs code/'callsite', no?

Surely if a function is only used once for the callsite, you can directly grab from the function return variables? (just wondering what is making this a confusing problem and im probably missing something)

faretek1 avatar Jan 25 '25 13:01 faretek1

However, if that function is used within another function which is also used for that same callsite, things become complicated

faretek1 avatar Mar 05 '25 22:03 faretek1