Live data from Hacker News

Lua beats MicroPython for embedded devs

embedded.com

71–80 of 87 posts

Re: Lua beats MicroPython for embedded devs

#71
post #61

Earlier quoted context omitted.

> What’s the dev experience actually like for serious Lua The dev experience for lua is f-ing awful. The language is small, but not “simple”; it’s stuck in 1985. The tooling is nearly non-existent and the stuff that does exist is a joke. The few libraries that exist are awful and barely maintained; the maintained libraries are maintained by neckbeards with a god-complex. The community is “reimplementing everything by…

Lua was designed in 1993. This was back when MS-DOS was still cutting edge and the 66MHz Pentium was cutting-edge consumer technology. Even "modern" languages often don't have features like first-class functions, closures, proper tail calls, etc that Lua has had for a very long time now. LuaJIT also trades blows with JS almost certainly making it the fastest or second-fastest dynamic language around. There's a lot to…

MS-DOS was never cutting edge, but I came here because I wonder about the performance claims.

https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

makes it look fairly slow, competing with Ruby, rather then JS.

Re: Lua beats MicroPython for embedded devs

#72
post #61

Earlier quoted context omitted.

Lua was designed in 1993. This was back when MS-DOS was still cutting edge and the 66MHz Pentium was cutting-edge consumer technology. Even "modern" languages often don't have features like first-class functions, closures, proper tail calls, etc that Lua has had for a very long time now. LuaJIT also trades blows with JS almost certainly making it the fastest or second-fastest dynamic language around. There's a lot to…

MS-DOS was never cutting edge, but I came here because I wonder about the performance claims. https://benchmarksgame-team.pages.debian.net/benchmarksgame/... makes it look fairly slow, competing with Ruby, rather then JS.

He removed LuaJIT from the benchmark opting to use the much slower Lua (Lua is used for small embedded stuff and LuaJIT is used for high-performance stuff with a popular recent example being the game Balatro). Here's the Vercel version which uses LuaJIT. I have no idea if the benchmarks were deoptimized by him (as he did to several language he thought "were too fast").

https://programming-language-benchmarks.vercel.app/lua-vs-ja...

LuaJIT used to have a performance comparison page, but it was removed a couple years ago apparently. It shows that LuaJIT is an average of around 16x faster than standard Lua (geomean). Very impressive considering it was written by just one guy for years (Mike Pall) and even more impressive when you consider that the JIT is only around 0.5mb (compare that with v8 which comes in at somewhere around 28mb IIRC).

https://web.archive.org/web/20230605114058/http://luajit.org...

Re: Lua beats MicroPython for embedded devs

#74

Earlier quoted context omitted.

"It isn't just X, it's Y" is textbook ChatGPT.

ChatGPT must have learned that from somewhere...

You're quite right to call that out! Of course real people also use that same formatting sometimes; but when ChatGPT does it? It's just chef's kiss.

Re: Lua beats MicroPython for embedded devs

#75
post #72

Earlier quoted context omitted.

MS-DOS was never cutting edge, but I came here because I wonder about the performance claims. https://benchmarksgame-team.pages.debian.net/benchmarksgame/... makes it look fairly slow, competing with Ruby, rather then JS.

He removed LuaJIT from the benchmark opting to use the much slower Lua (Lua is used for small embedded stuff and LuaJIT is used for high-performance stuff with a popular recent example being the game Balatro). Here's the Vercel version which uses LuaJIT. I have no idea if the benchmarks were deoptimized by him (as he did to several language he thought "were too fast"). https://programming-language-benchmarks.vercel.a…

> I have no idea if …

You have no idea.

> He removed LuaJIT

LuaJIT supports Lua 5.1

The benchmarks game shows Lua 5.4.7

Re: Lua beats MicroPython for embedded devs

#76
post #29

Earlier quoted context omitted.

Python also seems to have more issues with stability, in the sense that things randomly stop working when you upgrade from version 3.x to 3.x+1. Lua might not be perfect either, but at least it seems common that a platform supports a range of Lua versions instead of forcing an immediate upgrade.

Could you give some examples?

No, but we have a steady stream of tickets at work for scripts that must be fixed to work with a new minor python version.

I thought this was common knowledge. Just look at the non-empty list of removed things in every minor release changelog. If you have enough code to maintain something is going to affect you directly or indirectly.

https://docs.python.org/pl/dev/whatsnew/3.15.html

Re: Lua beats MicroPython for embedded devs

#77
post #75
post #72

Earlier quoted context omitted.

He removed LuaJIT from the benchmark opting to use the much slower Lua (Lua is used for small embedded stuff and LuaJIT is used for high-performance stuff with a popular recent example being the game Balatro). Here's the Vercel version which uses LuaJIT. I have no idea if the benchmarks were deoptimized by him (as he did to several language he thought "were too fast"). https://programming-language-benchmarks.vercel.a…

> I have no idea if … You have no idea. > He removed LuaJIT LuaJIT supports Lua 5.1 The benchmarks game shows Lua 5.4.7

> LuaJIT supports Lua 5.1

From what I understand, LuaJIT was removed before Lua 5.2 was released, so that wasn't the reason.

https://luajit.org/extensions.html

LuaJIT supports most of the features of Lua versions after 5.1 with the major missing feature being 64-bit integers, but like modern JS JITs, it actually uses 31/32-bit ints internally most of the time. Even in Lua 5.4 code, you are using implicit rather than explicit ints 99% of the time.

I haven't run the code to see, but I'm willing to bet that you can copy all the current benchmark code into LuaJIT and it'll run just fine.

> You have no idea.

I know with certainty that deoptimizations were applied to at least some scripts. Here's three examples for Common Lisp, StandardML, and Haskell over some time.

https://zerf.gitlab.io/ComputerLanguageBenchmarksGame2018Arc...

https://github.com/lemire/ComputerLanguageBenchmark/blob/fbe...

https://hackage.haskell.org/package/ajhc-0.8.0.4/src/example...

Here's a C example from Mike Pall (presumably the same guy who created LuaJIT) that also got the deopt treatment by Isaac Gouy.

https://github.com/lemire/ComputerLanguageBenchmark/blob/fbe...

It's not a question of if this happens -- only if it affects Lua (I've never checked).

Re: Lua beats MicroPython for embedded devs

#78
post #16

is anyone "serious" using micropython or lua for embedded work?

I have been developing Lua-heavy embedded products as a freelancer for about 20 years now, including VoIP devices, home automation controllers, industrial routers, digital video recorders, and more. These systems typically consist of a Linux kernel, some libc implementation, the lua interpreter and a few 3d party libs support libs to help building the app. The Lua apps ranges from 30k to 100k lines of code, depending…

the article is comparing micropython and lua, so i assume this is about MCU, not embedded linux.

Most of the time you have less than 1MB of ram on MCU

Re: Lua beats MicroPython for embedded devs

#79
post #77
post #75

Earlier quoted context omitted.

> I have no idea if … You have no idea. > He removed LuaJIT LuaJIT supports Lua 5.1 The benchmarks game shows Lua 5.4.7

> LuaJIT supports Lua 5.1 From what I understand, LuaJIT was removed before Lua 5.2 was released, so that wasn't the reason. https://luajit.org/extensions.html LuaJIT supports most of the features of Lua versions after 5.1 with the major missing feature being 64-bit integers, but like modern JS JITs, it actually uses 31/32-bit ints internally most of the time. Even in Lua 5.4 code, you are using implicit rather than…

> extensions.html

On that page, what words do you think support your claim "was removed before Lua 5.2 was released".

> I know with certainty

I made those code changes. I wrote de-optimized as a joke.

Re: Lua beats MicroPython for embedded devs

#80
post #77
post #75

Earlier quoted context omitted.

> I have no idea if … You have no idea. > He removed LuaJIT LuaJIT supports Lua 5.1 The benchmarks game shows Lua 5.4.7

> LuaJIT supports Lua 5.1 From what I understand, LuaJIT was removed before Lua 5.2 was released, so that wasn't the reason. https://luajit.org/extensions.html LuaJIT supports most of the features of Lua versions after 5.1 with the major missing feature being 64-bit integers, but like modern JS JITs, it actually uses 31/32-bit ints internally most of the time. Even in Lua 5.4 code, you are using implicit rather than…

Wait, that's news to me. Last time I checked, maybe 2 years ago, luajit supported some Lua >5.2 features. But, just a handful of those. Is it truly supporting most of the newer features nowadays?
Post reply on HN