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

Yes you should.

You'll need a glob function, cd/getcwd/setcwd, pretty-printer. That's about it.

Lua stdlib replaces sed, awk, grep, cut, tr, tail, etc.

Startup time is the best. In my testing, a lua script that functions like `echo` runs faster than echo.



> In my testing, a lua script that functions like `echo` runs faster than echo.

this is kind of hilarious

lua must be severely optimized at this point


so I finally got a luajit and some standard libs working together in my environment

the reason why it took so long is I use nixos and nix-darwin and... well, you know... it was non-obvious how to get everything working together "because Nix" but with the help of a good LLM I figured it out.

HOLY HELL IS THIS FAST.

i had the brand new chatgpt 4.1 rewrite a name=value pretty-printer terminal function from elixir (which I used because it was easy and maintainable, but at the cost of the VM startup) to lua.

272ms for the elixir version (`env | name-value-to-table`) vs. 17ms for the Lua version (`env | name-value-to-table-lua`). WOW. 1/16 the time LOL.

anyway here is that rewrite https://gist.github.com/pmarreck/47e110cbc62ea6603a0e61543d2...

Guess I'm gonna have to keep this in my toolkit! (And now that I figured out the Nix, it will remain easy!) Thanks!




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

Search: