this post was submitted on 30 Sep 2023
101 points (91.1% liked)
Programming
17526 readers
231 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities !webdev@programming.dev
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I 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.
My terminal is written in Ruby, and it uses a font-renderer that's 100% Ruby ( https://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.
That was a super cool article!
...As it happens, I'm writing a parser in Ruby right now, so this is incredibly timely. Thanks!