Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reducing Lua RAM usage #4

Open
asumagic opened this issue May 14, 2022 · 2 comments
Open

Reducing Lua RAM usage #4

asumagic opened this issue May 14, 2022 · 2 comments

Comments

@asumagic
Copy link
Collaborator

There is a number of things that could be done to reduce RAM usage, at varying levels of complexity:

  • Pre-compiling the core functions that are declared as Lua.
  • Allowing some strings to live in Flash rather than having to let Lua allocate them.
@asumagic
Copy link
Collaborator Author

Useful resource: http://www.eluaproject.net/doc/v0.9/en_arch_ltr.html

Could we have an AoT compiling mechanism based on copy-pasting chunks of the interpreter to limit branching and allow optimization across bytecode op sequences? It could be useful for some standard functions (though just rewriting them in C++ might be easier) but also for some snippets that we could match by a bytecode hash of some sort.

Unless we go the preprocessing route in which case it could be possible to AoT compile entire cartridges.

@asumagic
Copy link
Collaborator Author

It appears that the orbys demo uses 70KiB worth of Lua heap before even executing code. About 20KiB of that is the y8 runtime. Maybe some bytecode optimization would be worth it? See Opeth.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant