Open Aurel300 opened 1 year ago
Can we do better?
Regarding code size, there are certainly strategies to reduce it. This wouldn't be "for free" though, especially not if we consider the time somehow would have to spend on improving this. I'm quite interested in this from an academic point of view, but at some point it becomes difficult to justify the time investment.
This would require completely reviewing how bindings (and state in general) is handled. The code generation would also have to change drastically, perhaps to something resembling a coroutine. If you have any knowledge to share in this regard, please let me know!
Something that makes all this quite unsatisfying is that any such solution would likely lead to degraded performance for common cases. Whether or not that's justifiable is difficult to say, and perhaps the compiler could even decide on a code generation scheme depending on various factors.
(Loose follow up to #6731)
Here's a (silly) way to find the winner of a tic-tac-toe board:
With the full example, the generated code mostly consists of that switch statement. I measured the size of the generated Javascript code (compiled with
--dce full
) when adding line 8 only, then line 8-9, then line 8-10, etc. The size increases very quickly:Looking at the generated code I see unreasonable amounts of code like this:
Can we do better?