I'm writing about my experience with GraalVM and exposing the code to a Ruby library. Is this a good channel to share the posts, or even are people interested in this? 🙂
Sure! I’m doing other way around. Taking JS lib and adapting it to Clojure. Can’t wait to see your post
no, totally off topic....
of course! :)
So, here's part 1 of "Porting Clojure Libraries to Ruby": https://mauricio.szabo.link/blog/2024/04/15/porting-clojure-libraries-to-ruby/
I just started reading but it immediately popped my mind: have you considered running both Ruby and Clojure within the same JVM and/or the using the polyglot capabilities of GraalVM?
That's what I would miss from this article, now having read it entirely. There's more options, so the question is why did you choose this specific option, perhaps you're locked in on Ruby MRI?
Well, basically because nobody uses JRuby 🤣. Most projects are MRI only, and in all my years with Ruby I only saw two projects that ran under JRuby. In most cases, they don't even install (meaning there's a bunch of dependencies that don't run, nor have any equivalent). In fact, in most cases even different versions of MRI Ruby are not guaranteed to run the project 😞
It's a sad world out there were backwards compatibility is non-existent
Ok, the other option would be to run Ruby on GraalVM polyglot
it's actually much much faster than MRI or Jruby
Well, last time I used it didn't run half of the core Ruby code necessary to run Rails, and it was insanely slow so I didn't even consider it... thinking-face
ah ok. they use it as shopify a lot to save resources
Interesting, I'll check it later. Tried to check on an old project, but it doesn't even boot anymore... facepalm
Fwiw (maybe not much!) https://github.com/asciidoctor/asciidoctorj uses JRuby.
Well, here's my test suite running side-by-side with MRI, Truffle, and JRuby. In my own experience, Truffle was never faster than Ruby, or even JRuby. I don't know if it need a higher "warm up time", or things like that, but unfortunately I never got into a situation where I could make something run with TruffleRuby, because there was always some core functionality missing, like some OpenSSL extension that I depended on, etc... Also, isn't it amazing that in this 4-year old project, half of my code is broken just because I had to upgrade Ruby and that caused a cascade of gem upgrades that changed APIs? laughcry
Interesting. Their philosophy is: when TruffleRuby is slower than Ruby, they consider it a bug. So might be worth sharing this (and some of the test failures, if you can manage to reproduce which can be hard in the case of spaghetti Rails)