diff options
author | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-11-06 01:14:15 +0000 |
---|---|---|
committer | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-11-06 01:14:15 +0000 |
commit | f83116e620d75ee5390360132b1ada6fdff4fe63 (patch) | |
tree | 4533eac2b3a285ba251496e34430aec454163534 | |
parent | e6c84217346ab264ebf14ee42cf1deaa9bbc8316 (diff) | |
download | ruby-f83116e620d75ee5390360132b1ada6fdff4fe63.tar.gz |
lib/uri/rfc2396_parser.rb (initialize): reduce bytecode size
Reduce the initialize method from 2088 to 1332 bytes on 32-bit x86
Measurement obtained using `memsize_of_all', as `memsize_of'
is non-recursive:
a = ObjectSpace.memsize_of_all(RubyVM::InstructionSequence)
RubyVM::InstructionSequence.compile(src)
b = ObjectSpace.memsize_of_all(RubyVM::InstructionSequence)
p(b - a)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | lib/uri/rfc2396_parser.rb | 4 |
2 files changed, 7 insertions, 2 deletions
@@ -1,3 +1,8 @@ +Thu Nov 6 09:53:18 2014 Eric Wong <e@80x24.org> + + * lib/uri/rfc2396_parser.rb (initialize): reduce bytecode size + 2088 => 1332 bytes on 32-bit x86 + Thu Nov 6 08:49:49 2014 Martin Duerst <duerst@it.aoyama.ac.jp> * lib/unicode_normalize/normalize.rb: Comment clarification. diff --git a/lib/uri/rfc2396_parser.rb b/lib/uri/rfc2396_parser.rb index 50e3ae6973..c192f65ec1 100644 --- a/lib/uri/rfc2396_parser.rb +++ b/lib/uri/rfc2396_parser.rb @@ -98,11 +98,11 @@ module URI # def initialize(opts = {}) @pattern = initialize_pattern(opts) - @pattern.each_value {|v| v.freeze} + @pattern.each_value(&:freeze) @pattern.freeze @regexp = initialize_regexp(@pattern) - @regexp.each_value {|v| v.freeze} + @regexp.each_value(&:freeze) @regexp.freeze end |