-
Notifications
You must be signed in to change notification settings - Fork 34
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
Store lua libs as compiled lua bytecode #122
Comments
Investigated this some here, hit a bit of a wall. Lua doesn't bootstrap and running
It seems that Lua bytecode is not cross-platform (?!) and this |
from @simonvanderveldt:
Would that be something like this? https://github.com/nodemcu/nodemcu-firmware/blob/8d091c476edf6ae2977a5f2a74bf5824d07d6183/docs/compiling.md#compiling-lua-on-your-pc-for-uploading from @trentgill: After a quick read about LFS, it seems like this is a big endeavour, and likely something that requires another developer to make a reality. The big benefit is that we would free up a huge amount of RAM (presently Lua takes up over 100kB at boot time, and we only have 256kB total, a good chunk of which is devoted to hardware buffers & runtime processing). In practice we only get access to about 50kB of RAM in the VM before crashes or memory errors occur. If someone takes this project on, it would more than double the free memory available to scripts. This would have the added benefit of enabling support for >8kB userscripts (currently limited by the RAM allocation that happens while uploading & compiling on chip). |
One option to explore (which doesn't get around the Flash / RAM issue) is to use This might actually increase the size of binary which is the opposite of our goal, but perhaps changes the RAM footprint? Unlikely. But it's only a 1hour adventure to try it out and see the implications. |
Closing this issue because I believe it is not a real limitation we will hit. As I've been extending the lua libs, it seems that we are going to run out of RAM (taken up by the compiled lua) before we run out of flash. I did some investigation of the In essence, the limiting factor is RAM, and it is not affected significantly by the method of loading lua code. Instead I'm opening #390 as it is the realworld bottleneck. |
using some combination of
luac
andxxd
(akaHex Dump
) (or see this non-xxd version: https://codeplea.com/embedding-files-in-c-programs). This would replacel2h.fnl
which is our minimal solution that stores scripts as raw lua wrapped in c strings.i don't think this will effect RAM utilization, but perhaps
luac
performs optimizations thatloadstring()
in the runtime doesn't? both runtime RAM usage & flash storage should be benchmarked before switching.goals:
requirements:
make
) process significantly**this is an alternative to #40 **
The text was updated successfully, but these errors were encountered: