[#106341] [Ruby master Bug#18369] users.detect(:name, "Dorian") as shorthand for users.detect { |user| user.name == "Dorian" } — dorianmariefr <noreply@...>
Issue #18369 has been reported by dorianmariefr (Dorian Mari辿).
14 messages
2021/11/30
[#106351] [Ruby master Bug#18371] Release branches (release information in general) — "tenderlovemaking (Aaron Patterson)" <noreply@...>
Issue #18371 has been reported by tenderlovemaking (Aaron Patterson).
7 messages
2021/11/30
[ruby-core:106256] [Ruby master Bug#10902] require("enumerator") scans LOAD_PATH 2x on every invocation
From:
"usa (Usaku NAKAMURA)" <noreply@...>
Date:
2021-11-24 10:27:09 UTC
List:
ruby-core #106256
Issue #10902 has been updated by usa (Usaku NAKAMURA).
Backport changed from 2.7: REQUIRED, 3.0: DONE to 2.7: DONE, 3.0: DONE
ruby_2_7 f236548038048118e766232034511e4877a59b49 merged revision(s) 345db8f2aa373a31c619c8f85bd372f0a20829c1.
----------------------------------------
Bug #10902: require("enumerator") scans LOAD_PATH 2x on every invocation
https://bugs.ruby-lang.org/issues/10902#change-94876
* Author: tmm1 (Aman Gupta)
* Status: Closed
* Priority: Normal
* ruby -v: ruby 2.1.5
* Backport: 2.7: DONE, 3.0: DONE
----------------------------------------
On every invocation of `require "enumerator"` (for example during boot when many gems require it), the VM will scan the load path twice: once for enumerator.rb and again for enumerator.so. Of course, no file is found because enumerator is now shipped within the VM by default.
~~~
$ ruby -e' p $LOADED_FEATURES[0] '
"enumerator.so"
$ ruby -e' p $LOAD_PATH.size '
8
$ strace -e trace=open ruby -e' 1.times{ require "enumerator" } ' 2>&1 | grep enumerator.rb | wc -l
8
$ strace -e trace=open ruby -e' 1.times{ require "enumerator" } ' 2>&1 | grep enumerator.so | wc -l
8
$ strace -e trace=open ruby -e' 10.times{ require "enumerator" } ' 2>&1 | grep enumerator.so | wc -l
80
$ strace -e trace=open ruby -e' 100.times{ require "enumerator" } ' 2>&1 | grep enumerator.so | wc -l
800
~~~
In enumerator.c, we call `rb_provide("enumerator.so")` which adds it to $LOADED_FEATURES. This means `require "enumerator.so"` can be optimized, but most libraries do not include the .so extension when requiring enumerator.
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>