[#62904] [ruby-trunk - Feature #9894] [Open] [RFC] README.EXT: document rb_gc_register_mark_object — normalperson@...
Issue #9894 has been reported by Eric Wong.
3 messages
2014/06/02
[#63321] [ANN] ElixirConf 2014 - Don't Miss Jos辿 Valim and Dave Thomas — Jim Freeze <jimfreeze@...>
Just a few more weeks until ElixirConf 2014!
6 messages
2014/06/24
[#63391] Access Modifiers (Internal Interfaces) — Daniel da Silva Ferreira <danieldasilvaferreira@...>
Hi,
3 messages
2014/06/28
[ruby-core:62948] [ruby-trunk - Bug #9906] [Open] duplicated require of '.so' files?
From:
martin@...
Date:
2014-06-05 15:35:10 UTC
List:
ruby-core #62948
Issue #9906 has been reported by Martin Sarsale.
----------------------------------------
Bug #9906: duplicated require of '.so' files?
https://bugs.ruby-lang.org/issues/9906
* Author: Martin Sarsale
* Status: Open
* Priority: Normal
* Assignee:
* Category: core
* Target version:
* ruby -v: ruby 2.1.0p0 (2013-12-25 revision 44422) [i686-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
Dear all,
We are trying to get rid of autoload;
We could require everything in the first line of the file but instead we
prefer to require only what we need, when we need it.
So, instead of
require "digest/md5"
def foo(n)
Digest::MD5.hexdigest(n)
end
we would like to do:
def foo(n)
require "digest/md5"
Digest::MD5.hexdigest(n)
end
The problem we've found, is that duplicate `require(name)`, satisfied by
".rb" files are only executed once; but when file loaded by
require(name) is a '.so', next requires with the same name will be
executed again and again.
Example:
$ cat require-rb.rb
def foo(n)
require "set"
Set.new([n])
end
1000.times{|n|
puts foo(n)
}
$ strace -e trace=file -o require-rb.log ruby require-rb.rb
$ grep -c -E 'open.*/set' require-rb.log
8
$ cat require-so.rb
def foo(n)
require "digest/md5"
Digest::MD5.hexdigest(n.to_s)
end
1000.times{|n|
puts foo(n)
}
$ strace -e trace=file -o require-so.log ruby require-so.rb
$ grep -c -E 'open.*/md5' require-so.log
16001
Is this a bug or a feature?
--
https://bugs.ruby-lang.org/