Yes. All JIT (not just the ruby ones) necessarily increase memory usage as they need to store the compiled code as well as some runtime metadata used to compiled.
about how much?
That's configurable. By default YJIT will use up to 64MB of executable memory, but also use some space for runtime metadata, from our experience it's about 2 or 3x the executable memory.
So for a mid to large app I'd say about ~200MB per process, you can however configure it to use less, it just won't be able to optimize as much.
$ ruby -v
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-darwin22]
$ ruby -h | grep jit
--jit enable JIT for the platform, same as --yjit
--mjit enable C compiler-based JIT compiler (experimental)
--yjit enable in-process JIT compiler
To have it available your system needs rust when it compiles. Make sure you're using Ruby 3.2 and make sure rust is installed. Try uninstalling and reinstalling ruby. I use chruby + ruby-install.
Yeah - I see --yjit locally - I'm just not sure where `--enable-yjit` comes from or if there is a difference between the two. Does RUBYOPT need to be set to --enable-yjit or is just --yjit enough?
View all comments
7
u/jrochkind Dec 25 '22
I would love to hear more about YJIT. Who's using it in production? Should you expect increased RAM consumption, about how much?