RVM install Ruby with jemalloc and YJIT
mouse 556 · person cloud · link
Last update
2023-12-26
2023
12-26
« — »

Note: YJIT is only available on arm64 and aarch64.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
apt install rustc           # needed by YJIT
apt install libjemalloc-dev # needed by jemalloc

# install
rvm install ruby-3.3.0 -C --with-jemalloc --enable-yjit

# jemalloc test 1
MALLOC_CONF=stats_print:true rvm 3.3.0 do ruby -e "exit"

# jemalloc test 2
ldd `which ruby` | grep jemalloc
#   => libjemalloc.so.2 => /lib/aarch64-linux-gnu/libjemalloc.so.2

# YJIT test
ruby --yjit -v
#   => ruby 3.3.0 (2023-12-25 revision 5124f9ac75) +YJIT [aarch64-linux]

# YJIT lazy loading:
ruby --yjit --yjit-disable -e "... ; RubyVM::YJIT.enable ; ..."

Source: jemalloc @ stackoverflow.com, YJIT docs and RVM howto