Skip to content

Commit

Permalink
Merge pull request rails#53746 from aliismayilov/disable-yjit-on-test…
Browse files Browse the repository at this point in the history
…-env

Don't enable YJIT in development and test environments
  • Loading branch information
byroot authored Nov 26, 2024
2 parents ecaa641 + 76e2b7e commit 723ca0c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions guides/source/configuring.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ Below are the default values associated with each target version. In cases of co

#### Default Values for Target Version 8.1

- [`config.yjit`](#config-yjit): `!Rails.env.local?`

#### Default Values for Target Version 8.0

- [`Regexp.timeout`](#regexp-timeout): `1`
Expand Down Expand Up @@ -644,6 +646,7 @@ deploying to a memory constrained environment you may want to set this to `false
| --------------------- | -------------------- |
| (original) | `false` |
| 7.2 | `true` |
| 8.1 | `!Rails.env.local?` |

### Configuring Assets

Expand Down
7 changes: 7 additions & 0 deletions railties/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
* Don't enable YJIT in development and test environments

Development and test environment tend to reload code and redefine methods (e.g. mocking),
hence YJIT isn't generally faster in these environments.

*Ali Ismayilov*, *Jean Boussier*

* Only include PermissionsPolicy::Middleware if policy is configured.

*Petrik de Heus*
Expand Down
5 changes: 5 additions & 0 deletions railties/lib/rails/application/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,11 @@ def load_defaults(target_version)
Regexp.timeout ||= 1 if Regexp.respond_to?(:timeout=)
when "8.1"
load_defaults "8.0"

# Development and test environment tend to reload code and
# redefine methods (e.g. mocking), hence YJIT isn't generally
# faster in these environments.
self.yjit = !Rails.env.local?
else
raise "Unknown version #{target_version.to_s.inspect}"
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ def check

next if defaults_file_content.include? app_config

next if config == "self.yjit"

add_error(config)
end
end
Expand Down

0 comments on commit 723ca0c

Please sign in to comment.