Comment on What is your favorite programming language?
swordsmanluke@programming.dev 1 year agoI get that. Ruby does do a lot under the hood for me. But I like that! Different Strokes and all that.
I guess, for general programming tasks, I enjoy when the language is “clever” enough to do The Right Thing for all the bits I don’t really care about in the moment (like memory management) so I can focus on the logic that solves my problem.
Otoh, my last “big” personal project was a terminal multiplexer (and some supporting TUI widgets) that needed to run on a raspi zero W. I started in Python, then moved to Kotlin and finally Rust in the pursuit of performance. Once one of the parts I needed to care about became efficient performance, moving to a lower-level compiled language was the move.
Indeed, one app in particular took 1.5 min to run in Python…which ultimately dropped to 3 sec in Rust - and that was mostly network latency!
I love languages of all sorts. I’m currently writing an interpreter for a language I’m designing for fun. I’m starting off in Ruby while I figure this all out. I fully expect performance to be appalling. But Ruby lets me build faster while I’m testing things out and learning how interpreters work.
Once I’ve got my interpreter working though, I’m planning to port it to Rust for better performance.
vidarh@lemmy.stad.social 1 year ago
My terminal is written in Ruby, and it uses a font-renderer that’s 100% Ruby ( github.com/vidarh/skrift - I didn’t write it from scratch, it’s a port from C ), and it’s definitely possible to get things “fast enough” for a surprising portion of code in Ruby these days, but you may end up writing Ruby code that is “surprising”. For faster Ruby, see e.g. Aaron Patterson’s walkthrough of speeding up a lexer which ends up doing things most Ruby devs would not usually do because at least some of the things he ends up doing goes against the readability (e.g. the TrueType renderer I linked above definitely sacrifices speed and assumes you’ll memoize heavily to maintain readability). For an interpreter, you’re probably right to drop to something lower level.
swordsmanluke@programming.dev 1 year ago
That was a super cool article!
…As it happens, I’m writing a parser in Ruby right now, so this is incredibly timely. Thanks!