<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/load.c, branch v3_2_11</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>[Bug #21629] Initialize `struct RString`</title>
<updated>2026-01-22T09:02:29+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2025-10-08T09:19:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=357d601e8b44b2d2b99ffaf05f6912c4c705c4e6'/>
<id>357d601e8b44b2d2b99ffaf05f6912c4c705c4e6</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) d4a1a2780c39bc648496ac92fc6e6ce2eb38ab47: [Backport #21032]</title>
<updated>2025-03-13T05:27:06+00:00</updated>
<author>
<name>Hiroshi SHIBATA</name>
<email>hsbt@ruby-lang.org</email>
</author>
<published>2025-03-12T09:08:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=1c9af6c10f97c0b612492fa63842c78ea2b8da56'/>
<id>1c9af6c10f97c0b612492fa63842c78ea2b8da56</id>
<content type='text'>
	rb_feature_p: skip `get_expanded_load_path` for absolute paths

	Ref: https://github.com/fxn/zeitwerk/pull/308

	```ruby
	require 'benchmark'

	$LOAD_PATH &lt;&lt; 'relative-path'

	autoload :FOO, '/tmp/foo.rb'

	puts Benchmark.realtime {
	  500_000.times do
	    Object.autoload?(:FOO)
	  end
	}
	```

	The above script takes 2.5 seconds on `master`, and only
	50ms on this branch.

	When we're looking for a feature with an absolute path, we don't
	need to call the expensive `get_expanded_load_path`.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	rb_feature_p: skip `get_expanded_load_path` for absolute paths

	Ref: https://github.com/fxn/zeitwerk/pull/308

	```ruby
	require 'benchmark'

	$LOAD_PATH &lt;&lt; 'relative-path'

	autoload :FOO, '/tmp/foo.rb'

	puts Benchmark.realtime {
	  500_000.times do
	    Object.autoload?(:FOO)
	  end
	}
	```

	The above script takes 2.5 seconds on `master`, and only
	50ms on this branch.

	When we're looking for a feature with an absolute path, we don't
	need to call the expensive `get_expanded_load_path`.
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) adaff1fc496b6f01fb1c4c812b9b4082618e2f79: [Backport #19592]</title>
<updated>2024-04-07T05:41:29+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@ruby-lang.org</email>
</author>
<published>2024-04-07T05:41:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=baa5bc16c17e3b4dac7b590ed5d6b7e705535e15'/>
<id>baa5bc16c17e3b4dac7b590ed5d6b7e705535e15</id>
<content type='text'>
	[Bug #19592] Fix ext/Setup support

	After [1], using ext/Setup to link some, but not all extensions failed
	during linking. I did not know about this option, and had assumed that
	only `--with-static-linked-ext` builds can include statically linked
	extensions.

	Include the support code for statically linked extensions in all
	configurations like before [1]. Initialize the table lazily to minimize
	footprint on builds that have no statically linked extensions.

	[1]: 790cf4b6d0475614afb127b416e87cfa39044d67 "Fix autoload status of
	         statically linked extensions"
	---
	 load.c    | 28 +++++++++++++++++-----------
	 vm.c      |  3 ---
	 vm_core.h |  6 ------
	 3 files changed, 17 insertions(+), 20 deletions(-)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	[Bug #19592] Fix ext/Setup support

	After [1], using ext/Setup to link some, but not all extensions failed
	during linking. I did not know about this option, and had assumed that
	only `--with-static-linked-ext` builds can include statically linked
	extensions.

	Include the support code for statically linked extensions in all
	configurations like before [1]. Initialize the table lazily to minimize
	footprint on builds that have no statically linked extensions.

	[1]: 790cf4b6d0475614afb127b416e87cfa39044d67 "Fix autoload status of
	         statically linked extensions"
	---
	 load.c    | 28 +++++++++++++++++-----------
	 vm.c      |  3 ---
	 vm_core.h |  6 ------
	 3 files changed, 17 insertions(+), 20 deletions(-)
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) 1f115f141dd17f75049a5e17107906c5bcc372e1:</title>
<updated>2023-11-18T03:06:27+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@ruby-lang.org</email>
</author>
<published>2023-11-18T02:28:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=5baf94f9131fb45d50c8c408e007a138ced46606'/>
<id>5baf94f9131fb45d50c8c408e007a138ced46606</id>
<content type='text'>
	Speed up rebuilding the loaded feature index

	Rebuilding the loaded feature index slowed down with the bug fix
	for #17885 in 79a4484a072e9769b603e7b4fbdb15b1d7eccb15.  The
	slowdown was extreme if realpath emulation was used, but even when
	not emulated, it could be about 10x slower.

	This adds loaded_features_realpath_map to rb_vm_struct. This is a
	hidden hash mapping loaded feature paths to realpaths. When
	rebuilding the loaded feature index, look at this hash to get
	cached realpath values, and skip calling rb_check_realpath if a
	cached value is found.

	Fixes [Bug #19246]
	---
	 load.c    | 27 +++++++++++++++++++++++----
	 vm.c      |  2 ++
	 vm_core.h |  1 +
	 3 files changed, 26 insertions(+), 4 deletions(-)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	Speed up rebuilding the loaded feature index

	Rebuilding the loaded feature index slowed down with the bug fix
	for #17885 in 79a4484a072e9769b603e7b4fbdb15b1d7eccb15.  The
	slowdown was extreme if realpath emulation was used, but even when
	not emulated, it could be about 10x slower.

	This adds loaded_features_realpath_map to rb_vm_struct. This is a
	hidden hash mapping loaded feature paths to realpaths. When
	rebuilding the loaded feature index, look at this hash to get
	cached realpath values, and skip calling rb_check_realpath if a
	cached value is found.

	Fixes [Bug #19246]
	---
	 load.c    | 27 +++++++++++++++++++++++----
	 vm.c      |  2 ++
	 vm_core.h |  1 +
	 3 files changed, 26 insertions(+), 4 deletions(-)
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) 4329554f171fdb483cafa672df5f2a08741940c5,b5c74d548872388921402ff2db36be15e924a89b: [Backport #19985]</title>
<updated>2023-11-09T08:36:42+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@ruby-lang.org</email>
</author>
<published>2023-11-09T08:36:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=2aaa9af75989bb0993a44e9690ed2ca890b2ff91'/>
<id>2aaa9af75989bb0993a44e9690ed2ca890b2ff91</id>
<content type='text'>
	[Bug #19985] Raise LoadError with the converted feature name

	`Kernel#require` converts feature name objects that have the `to_path`
	method such as `Pathname`, but had used the original object on error
	and had resulted in an unexpected `TypeError`.
	---
	 load.c                    | 14 +++++++++++---
	 test/ruby/test_require.rb | 26 +++++++++++++++++++++-----
	 2 files changed, 32 insertions(+), 8 deletions(-)

	Ease the `Encoding::CompatibilityError` test failure

	At the time this test first started using `assert_raise_with_message`,
	it did not touch `Encoding.default_internal`.
	---
	 test/ruby/test_require.rb | 3 ++-
	 1 file changed, 2 insertions(+), 1 deletion(-)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	[Bug #19985] Raise LoadError with the converted feature name

	`Kernel#require` converts feature name objects that have the `to_path`
	method such as `Pathname`, but had used the original object on error
	and had resulted in an unexpected `TypeError`.
	---
	 load.c                    | 14 +++++++++++---
	 test/ruby/test_require.rb | 26 +++++++++++++++++++++-----
	 2 files changed, 32 insertions(+), 8 deletions(-)

	Ease the `Encoding::CompatibilityError` test failure

	At the time this test first started using `assert_raise_with_message`,
	it did not touch `Encoding.default_internal`.
	---
	 test/ruby/test_require.rb | 3 ++-
	 1 file changed, 2 insertions(+), 1 deletion(-)
</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "Re-apply "Ruby 3.2 - Speed up rebuilding the loaded feature index and realpath cache (#8023)" (#8252)"</title>
<updated>2023-08-24T07:06:32+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@ruby-lang.org</email>
</author>
<published>2023-08-24T05:56:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=e777064e4b064fd77aca65c123f1919433f6732d'/>
<id>e777064e4b064fd77aca65c123f1919433f6732d</id>
<content type='text'>
This reverts commit 788b03d5ba82fd8b35ce1fe2618ce6bacc648333.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts commit 788b03d5ba82fd8b35ce1fe2618ce6bacc648333.
</pre>
</div>
</content>
</entry>
<entry>
<title>Re-apply "Ruby 3.2 - Speed up rebuilding the loaded feature index and realpath cache (#8023)" (#8252)</title>
<updated>2023-08-21T23:33:47+00:00</updated>
<author>
<name>MSP-Greg</name>
<email>MSP-Greg@users.noreply.github.com</email>
</author>
<published>2023-08-21T23:33:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=788b03d5ba82fd8b35ce1fe2618ce6bacc648333'/>
<id>788b03d5ba82fd8b35ce1fe2618ce6bacc648333</id>
<content type='text'>
* Re-apply "Ruby 3.2 - Speed up rebuilding the loaded feature index and realpath cache (#8023)"

* [CI] mingw.yml - remove IBM437 encoding for test-all, use cmd shell for test &amp; test-all

* Skip failing test on mingw with readline.so

Co-authored-by: nagachika &lt;nagachika@ruby-lang.org&gt;

---------

Co-authored-by: nagachika &lt;nagachika@ruby-lang.org&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Re-apply "Ruby 3.2 - Speed up rebuilding the loaded feature index and realpath cache (#8023)"

* [CI] mingw.yml - remove IBM437 encoding for test-all, use cmd shell for test &amp; test-all

* Skip failing test on mingw with readline.so

Co-authored-by: nagachika &lt;nagachika@ruby-lang.org&gt;

---------

Co-authored-by: nagachika &lt;nagachika@ruby-lang.org&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "Ruby 3.2 - Speed up rebuilding the loaded feature index and realpath cache (#8023)"</title>
<updated>2023-07-29T08:58:42+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@ruby-lang.org</email>
</author>
<published>2023-07-29T08:58:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=1c7624469880bcb964be09a49e4907873f45b026'/>
<id>1c7624469880bcb964be09a49e4907873f45b026</id>
<content type='text'>
This reverts commit 8346d1630b8193eef1ec9dd537b16de74afdc2e8.
It seems break CI on MinGW.
https://github.com/ruby/ruby/actions/runs/5698775895/job/15447455988
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts commit 8346d1630b8193eef1ec9dd537b16de74afdc2e8.
It seems break CI on MinGW.
https://github.com/ruby/ruby/actions/runs/5698775895/job/15447455988
</pre>
</div>
</content>
</entry>
<entry>
<title>Ruby 3.2 - Speed up rebuilding the loaded feature index and realpath cache (#8023)</title>
<updated>2023-07-29T05:27:11+00:00</updated>
<author>
<name>Kerem Kat</name>
<email>keremkat@gmail.com</email>
</author>
<published>2023-07-29T05:27:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=8346d1630b8193eef1ec9dd537b16de74afdc2e8'/>
<id>8346d1630b8193eef1ec9dd537b16de74afdc2e8</id>
<content type='text'>
* Speed up rebuilding the loaded feature index

Rebuilding the loaded feature index slowed down with the bug fix
for #17885 in 79a4484a072e9769b603e7b4fbdb15b1d7eccb15.  The
slowdown was extreme if realpath emulation was used, but even when
not emulated, it could be about 10x slower.

This adds loaded_features_realpath_map to rb_vm_struct. This is a
hidden hash mapping loaded feature paths to realpaths. When
rebuilding the loaded feature index, look at this hash to get
cached realpath values, and skip calling rb_check_realpath if a
cached value is found.

Fixes [Bug #19246]

* Add a realpath cache to reduce number of syscalls.

Number of lstat and stat syscalls for each 'require'd file is doubled,
because rb_realpath_internal is called from two places with the same
arguments in require_internal; once for checking the realpaths cache,
and once in load_iseq_eval when iseq is not found.

Introduce rb_realpath_internal_cached function to reuse the realpath_map
cache which memoizes rb_realpath_internal function, leading to less
syscalls and increased startup performance depending on the cost of the syscalls
in a particular environment.

---------

Co-authored-by: Jeremy Evans &lt;code@jeremyevans.net&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Speed up rebuilding the loaded feature index

Rebuilding the loaded feature index slowed down with the bug fix
for #17885 in 79a4484a072e9769b603e7b4fbdb15b1d7eccb15.  The
slowdown was extreme if realpath emulation was used, but even when
not emulated, it could be about 10x slower.

This adds loaded_features_realpath_map to rb_vm_struct. This is a
hidden hash mapping loaded feature paths to realpaths. When
rebuilding the loaded feature index, look at this hash to get
cached realpath values, and skip calling rb_check_realpath if a
cached value is found.

Fixes [Bug #19246]

* Add a realpath cache to reduce number of syscalls.

Number of lstat and stat syscalls for each 'require'd file is doubled,
because rb_realpath_internal is called from two places with the same
arguments in require_internal; once for checking the realpaths cache,
and once in load_iseq_eval when iseq is not found.

Introduce rb_realpath_internal_cached function to reuse the realpath_map
cache which memoizes rb_realpath_internal function, leading to less
syscalls and increased startup performance depending on the cost of the syscalls
in a particular environment.

---------

Co-authored-by: Jeremy Evans &lt;code@jeremyevans.net&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) 8ce2fb9bbbaea14737c84385b1573f743a30f773,3a0f6ce1d31eefd8af01b50f3632a64d64e8f8c1: [Backport #19415]</title>
<updated>2023-03-02T00:29:38+00:00</updated>
<author>
<name>NARUSE, Yui</name>
<email>naruse@airemix.jp</email>
</author>
<published>2023-03-02T00:28:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=53f6173cfc085a7422b4a76c85e6c35969209327'/>
<id>53f6173cfc085a7422b4a76c85e6c35969209327</id>
<content type='text'>
	Only emit circular dependency warning for owned thread shields [Bug
	 #19415]

	If multiple threads attemps to load the same file concurrently
	it's not a circular dependency issue.

	So we check that the existing ThreadShield is owner by the current
	fiber before warning about circular dependencies.
	---
	 internal/thread.h                                     |  1 +
	 load.c                                                |  3 ++-
	 spec/ruby/core/kernel/shared/require.rb               | 11 +++++++++++
	 spec/ruby/fixtures/code/concurrent_require_fixture.rb |  4 ++++
	 test/ruby/test_require.rb                             |  3 ---
	 thread.c                                              | 11 +++++++++++
	 6 files changed, 29 insertions(+), 4 deletions(-)
	 create mode 100644 spec/ruby/fixtures/code/concurrent_require_fixture.rb

	Use Thread.pass until thread.stop? to wait for thread to block

	[Bug #19415]

	It should be more reliable
	---
	 spec/ruby/fixtures/code/concurrent_require_fixture.rb | 2 +-
	 1 file changed, 1 insertion(+), 1 deletion(-)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	Only emit circular dependency warning for owned thread shields [Bug
	 #19415]

	If multiple threads attemps to load the same file concurrently
	it's not a circular dependency issue.

	So we check that the existing ThreadShield is owner by the current
	fiber before warning about circular dependencies.
	---
	 internal/thread.h                                     |  1 +
	 load.c                                                |  3 ++-
	 spec/ruby/core/kernel/shared/require.rb               | 11 +++++++++++
	 spec/ruby/fixtures/code/concurrent_require_fixture.rb |  4 ++++
	 test/ruby/test_require.rb                             |  3 ---
	 thread.c                                              | 11 +++++++++++
	 6 files changed, 29 insertions(+), 4 deletions(-)
	 create mode 100644 spec/ruby/fixtures/code/concurrent_require_fixture.rb

	Use Thread.pass until thread.stop? to wait for thread to block

	[Bug #19415]

	It should be more reliable
	---
	 spec/ruby/fixtures/code/concurrent_require_fixture.rb | 2 +-
	 1 file changed, 1 insertion(+), 1 deletion(-)
</pre>
</div>
</content>
</entry>
</feed>
