Fork me on GitHub
#graalvm
<
2024-04-15
>
mauricio.szabo16:04:12

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? 🙂

Karol Wójcik16:04:09

Sure! I’m doing other way around. Taking JS lib and adapting it to Clojure. Can’t wait to see your post

borkdude16:04:48

no, totally off topic....

borkdude16:04:54

of course! :)

borkdude18:04:05

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?

borkdude18:04:10

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?

mauricio.szabo18:04:27

Well, basically because nobody uses JRuby :rolling_on_the_floor_laughing:. 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 😞

mauricio.szabo18:04:46

It's a sad world out there were backwards compatibility is non-existent

borkdude19:04:08

Ok, the other option would be to run Ruby on GraalVM polyglot

borkdude19:04:20

it's actually much much faster than MRI or Jruby

mauricio.szabo19:04:56

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

borkdude19:04:32

ah ok. they use it as shopify a lot to save resources

mauricio.szabo19:04:30

Interesting, I'll check it later. Tried to check on an old project, but it doesn't even boot anymore... facepalm

mauricio.szabo20:04:38

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

borkdude20:04:04

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)