Want to get started with YJIT? See the latest README for details. The short version goes:
# If you have a YJIT-capable Ruby installed, run with the --yjit flag ruby --yjit my_file_to_make_faster.rb RUBYOPT="--yjit" rails server # Any Ruby 3.1.0 or later has YJIT support rvm install ruby-3.1 ruby-build 3.1.0 ~/.rubies/ruby-3.1.0
You can install Ruby 3.1.0 or higher to get the most recent release of YJIT. 3.2.0 or higher is strongly preferred for long-running servers.
Snippets to disassemble chunks of Ruby code:
# To disassemble Ruby bytecode: puts RubyVM::InstructionSequence.disassemble(method :whatever_method) # Ruby bytecode plus YJIT assembly language (only on dev YJIT): puts RubyVM::YJIT.disasm(method :whatever_method) # If you want to do YJIT disassembly, you'll need to run with YJIT ruby --yjit my_disassembly_test.rb # And when you build Ruby, you'll need to turn on dev YJIT: ./configure --yjit-enable=dev
You can find more BBV and YJIT talks and papers in the CRuby YJIT README.