Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

How Lua is viable in embedded? You mean microcontroller/low-level programming right?


I once worked on a project at a FAANG where we had to run an app on a 600Mhz CPU with no FPU. Javascript (v8, spidermonkey) wouldn't cut it (for some reasons function calls where very slow amongst other things). While Lua was incredibly fast on that hardware and the VM footprint was also a blessing. Even better, we could send a binary blob of the Lua VM/app state over the wire, and so we could precompute the whole app start on a server and send that to the device (the app would start in under 5 secondes instead of minutes as it would just load the blob). Best hacking time of my career, thanks to Lua.


Embedded is a fuzzy category, specs range from <1kb Ram to the low megabytes. Some people even extend it till low end smartphones and things like raspberry pies which are like gaming PCs by mid 2000s standards.

Lua is extremely lightweight and portable. The interpreter doesn't exceed 500 kb in the fattest build, and the used dialect is a strict subset of ANSI C that is equally comfortable running on mainframes as on Nintendo consoles.

In short : If it has a C compiler and can spare 300 kb ram, it can run Lua. So people sometimes use it there.


>Embedded is a fuzzy category, specs range from <1kb Ram to the low megabytes.

After a career in embedded software, I'd have to say that I've only worked on a couple of products that had less oomph than a high-end PC of the same era.


Indeed (see also "embedded Linux" being a thing), people insisting if something doesn't run on a tiny PIC it can't be useful for "embedded" is a pet peeve of mine.

Depending on the context, "embedded systems" go even larger, although usually people stop calling it "embedded programming" at some point. Obviously many problems in large embedded systems are different from small ones, but others remain similar.


I imagine they are annoyed because it used to be more clear, easier to google, etc. The discussion and search space was polluted for them as the meaning of the term changed, and no new term filled the void.


"microcontroller" seems like a term that would differentiate from things like embedded Linux and SoCs.


When was that? The range wasn't as large because the top end was way more limited, but the same thing applied at least since the 90s.


My impression in the 90s is that most people talking about embedded were talking about microcontrollers or very limited microprocessors.


My counterpoints would be e.g. QNX and vxWorks, famous embedded OSes, both being active in the 90s (roots go to the 80s, but in both cases afaik they really came into being and found a market in the 90s). Plenty 90s embedded hardware with x86 CPUs in it.

What's probably different today is that you have more options also on MCUs (not just assembly and maybe C), because MCUs have grown.


In this case, I believe "embedded" means "in another program, as a scripting language".




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: