forwardable.rb: reduce allocations in def_delegators
* lib/forwardable.rb (Forwardable::FILE_REGEXP): create regexp object outside sources for eval, to reduce allocations in def_delegators wrappers. //o option does not make each regexps shared. patch by tmm1 (Aman Gupta) in [ruby-core:53620] [Bug #8143]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39875 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
228b29a697
commit
cfe937b9b2
@ -1,3 +1,10 @@
|
|||||||
|
Fri Mar 22 17:48:34 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* lib/forwardable.rb (Forwardable::FILE_REGEXP): create regexp object
|
||||||
|
outside sources for eval, to reduce allocations in def_delegators
|
||||||
|
wrappers. //o option does not make each regexps shared. patch by
|
||||||
|
tmm1 (Aman Gupta) in [ruby-core:53620] [Bug #8143].
|
||||||
|
|
||||||
Fri Mar 22 17:38:42 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Fri Mar 22 17:38:42 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* load.c (rb_feature_p), vm_core.h (rb_vm_struct): turn
|
* load.c (rb_feature_p), vm_core.h (rb_vm_struct): turn
|
||||||
|
@ -102,6 +102,8 @@ module Forwardable
|
|||||||
# Version of +forwardable.rb+
|
# Version of +forwardable.rb+
|
||||||
FORWARDABLE_VERSION = "1.1.0"
|
FORWARDABLE_VERSION = "1.1.0"
|
||||||
|
|
||||||
|
FILE_REGEXP = %r"#{Regexp.quote(__FILE__)}"
|
||||||
|
|
||||||
@debug = nil
|
@debug = nil
|
||||||
class << self
|
class << self
|
||||||
# If true, <tt>__FILE__</tt> will remain in the backtrace in the event an
|
# If true, <tt>__FILE__</tt> will remain in the backtrace in the event an
|
||||||
@ -170,7 +172,7 @@ module Forwardable
|
|||||||
begin
|
begin
|
||||||
#{accessor}.__send__(:#{method}, *args, &block)
|
#{accessor}.__send__(:#{method}, *args, &block)
|
||||||
rescue Exception
|
rescue Exception
|
||||||
$@.delete_if{|s| %r"#{Regexp.quote(__FILE__)}"o =~ s} unless Forwardable::debug
|
$@.delete_if{|s| Forwardable::FILE_REGEXP =~ s} unless Forwardable::debug
|
||||||
::Kernel::raise
|
::Kernel::raise
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -262,7 +264,7 @@ module SingleForwardable
|
|||||||
begin
|
begin
|
||||||
#{accessor}.__send__(:#{method}, *args, &block)
|
#{accessor}.__send__(:#{method}, *args, &block)
|
||||||
rescue Exception
|
rescue Exception
|
||||||
$@.delete_if{|s| %r"#{Regexp.quote(__FILE__)}"o =~ s} unless Forwardable::debug
|
$@.delete_if{|s| Forwardable::FILE_REGEXP =~ s} unless Forwardable::debug
|
||||||
::Kernel::raise
|
::Kernel::raise
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user