Skip to content

Commit 76e2b7e

Browse files
aliismayilovbyroot
andcommitted
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. Co-Authored-By: Jean Boussier <[email protected]>
1 parent ce8a6f1 commit 76e2b7e

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

guides/source/configuring.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ Below are the default values associated with each target version. In cases of co
6060

6161
#### Default Values for Target Version 8.1
6262

63+
- [`config.yjit`](#config-yjit): `!Rails.env.local?`
64+
6365
#### Default Values for Target Version 8.0
6466

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

648651
### Configuring Assets
649652

railties/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
* Don't enable YJIT in development and test environments
2+
3+
Development and test environment tend to reload code and redefine methods (e.g. mocking),
4+
hence YJIT isn't generally faster in these environments.
5+
6+
*Ali Ismayilov*, *Jean Boussier*
7+
18
* Only include PermissionsPolicy::Middleware if policy is configured.
29

310
*Petrik de Heus*

railties/lib/rails/application/configuration.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,11 @@ def load_defaults(target_version)
348348
Regexp.timeout ||= 1 if Regexp.respond_to?(:timeout=)
349349
when "8.1"
350350
load_defaults "8.0"
351+
352+
# Development and test environment tend to reload code and
353+
# redefine methods (e.g. mocking), hence YJIT isn't generally
354+
# faster in these environments.
355+
self.yjit = !Rails.env.local?
351356
else
352357
raise "Unknown version #{target_version.to_s.inspect}"
353358
end

tools/rail_inspector/lib/rail_inspector/configuring/check/framework_defaults.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ def check
2121

2222
next if defaults_file_content.include? app_config
2323

24+
next if config == "self.yjit"
25+
2426
add_error(config)
2527
end
2628
end

0 commit comments

Comments
 (0)