From 1b6eb2c7f0425a20f9bd823419138bf8adfa18f4 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Thu, 16 May 2024 05:56:48 -0400 Subject: [PATCH] Enable YJIT when available (#30310) --- config/initializers/enable_yjit.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 config/initializers/enable_yjit.rb diff --git a/config/initializers/enable_yjit.rb b/config/initializers/enable_yjit.rb new file mode 100644 index 00000000000..7b1053ec114 --- /dev/null +++ b/config/initializers/enable_yjit.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +# Automatically enable YJIT as of Ruby 3.3, as it brings very +# sizeable performance improvements. + +# If you are deploying to a memory constrained environment +# you may want to delete this file, but otherwise it's free +# performance. +if defined?(RubyVM::YJIT.enable) + Rails.application.config.after_initialize do + RubyVM::YJIT.enable + end +end