[前][次][番号順一覧][スレッド一覧]

ruby-changes:36211

From: normal <ko1@a...>
Date: Thu, 6 Nov 2014 10:14:32 +0900 (JST)
Subject: [ruby-changes:36211] normal:r48292 (trunk): lib/uri/rfc2396_parser.rb (initialize): reduce bytecode size

normal	2014-11-06 10:14:15 +0900 (Thu, 06 Nov 2014)

  New Revision: 48292

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48292

  Log:
    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)

  Modified files:
    trunk/ChangeLog
    trunk/lib/uri/rfc2396_parser.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 48291)
+++ ChangeLog	(revision 48292)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Nov  6 09:53:18 2014  Eric Wong  <e@8...>
+
+	* 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@i...>
 
 	* lib/unicode_normalize/normalize.rb: Comment clarification.
Index: lib/uri/rfc2396_parser.rb
===================================================================
--- lib/uri/rfc2396_parser.rb	(revision 48291)
+++ lib/uri/rfc2396_parser.rb	(revision 48292)
@@ -98,11 +98,11 @@ module URI https://github.com/ruby/ruby/blob/trunk/lib/uri/rfc2396_parser.rb#L98
     #
     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
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]