4 ms·
Interestingly, I hadn't even considered Lua for this in any way. In my (entirely unresearched, and opinionated) mind, Lua is in spirit, an older, less expressi
by stestagg 9y ago
Interestingly, I hadn't even considered Lua for this in any way.
In my (entirely unresearched, and opinionated) mind, Lua is in spirit, an older, less expressive, version of python. I know there's some impressive and interesting jit/compiler projects around lua that make it great, but it doesn't seem to help with the actual problem I was facing, which was low ram.
The nrf51822 has 128kb ROM, and only 16KB ram, so any allocations that happen at run time are comparatively VERY expensive.
bitflyer has about (guestimate) 40kb of static resources, for bitmaps and music. This means those resources had to be static, and loading/managing them in ram is hard. As an example, to buffer the display in memory is 1/16th of your entire ram.
With rust, this meant that I effectively had a 14kb stack, that is almost guaranteed to be non-fragmented, (I haven't got round to measuring the actual stack size, but I think probably no more than a 3/4 Kb actually used on average) and no heap to worry about.
As far as I can tell, Lua uses a heap-based GC model which means unpredictable usage, and fragmentation.
- mmjaa 9y ago>an older, less expressive, version of python. Wow, that's a bit of a pity, yo. I don't think thats at all correct. They're completely different languages and ecosystems. Where Python has a fat history, Lua is mean and light. >As far as I can tell, Lua uses a heap-based GC model which means unpredictable usage, and fragmentation. Well, its all quite tweakable: http://www.eluaproject.net/doc/v0.9/en_arch_ltr.html http://www.eluaproject.net/doc/v0.9/en_arch_ltr.html EDIT: Mike Pall himself has weighed in on this subject, and I thought maybe you might to hear it straight from the horses mouth: http://lua-users.org/lists/lua-l/2005-07/msg00221.html http://lua-users.org/lists/lua-l/2005-07/msg00221.html .. though, with LuaJIT and eLua around now, things have changed a fair bit since 2005.
- maxerickson 9y agoPython is also older than lua. And I think if you look at popularity in, say, 2000, Python was much more widely known by then.
- stestagg 9y agoSorry, that wasn't meant as a slur on the Language, just an expression on my uninformed background-opinion of it, trying to explain why I didn't go for this. As for the eLua tweaks, things like rotables are quite cool, but ultimately you loose the ability to define them in lua, so, like micropython, it's doable, but just means you sacrifice the non-c nature of it to do so. :)