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

ruby-changes:43400

From: naruse <ko1@a...>
Date: Tue, 21 Jun 2016 03:27:49 +0900 (JST)
Subject: [ruby-changes:43400] naruse:r55474 (trunk): Don't cache simple data to reduce memory usage

naruse	2016-06-21 03:27:45 +0900 (Tue, 21 Jun 2016)

  New Revision: 55474

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

  Log:
    Don't cache simple data to reduce memory usage

  Modified files:
    trunk/test/ruby/enc/test_case_comprehensive.rb
Index: test/ruby/enc/test_case_comprehensive.rb
===================================================================
--- test/ruby/enc/test_case_comprehensive.rb	(revision 55473)
+++ test/ruby/enc/test_case_comprehensive.rb	(revision 55474)
@@ -41,19 +41,19 @@ class TestComprehensiveCaseFold < Test:: https://github.com/ruby/ruby/blob/trunk/test/ruby/enc/test_case_comprehensive.rb#L41
   def self.read_data
     @@codepoints = []
 
-    downcase  = Hash.new { |h, c| h[c] = c }
-    upcase    = Hash.new { |h, c| h[c] = c }
-    titlecase = Hash.new { |h, c| h[c] = c }
-    casefold  = Hash.new { |h, c| h[c] = c }
-    swapcase  = Hash.new { |h, c| h[c] = c }
-    turkic_upcase    = Hash.new { |h, c| h[c] = upcase[c] }
-    turkic_downcase  = Hash.new { |h, c| h[c] = downcase[c] }
-    turkic_titlecase = Hash.new { |h, c| h[c] = titlecase[c] }
-    turkic_swapcase  = Hash.new { |h, c| h[c] = swapcase[c] }
-    ascii_upcase     = Hash.new { |h, c| h[c] = c =~ /\A[a-zA-Z]\z/ ? upcase[c] : c }
-    ascii_downcase   = Hash.new { |h, c| h[c] = c =~ /\A[a-zA-Z]\z/ ? downcase[c] : c }
-    ascii_titlecase  = Hash.new { |h, c| h[c] = c =~ /\A[a-zA-Z]\z/ ? titlecase[c] : c }
-    ascii_swapcase   = Hash.new { |h, c| h[c] = c=~/\A[a-z]\z/ ? upcase[c] : (c=~/\A[A-Z]\z/ ? downcase[c] : c) }
+    downcase  = Hash.new { |h, c| c }
+    upcase    = Hash.new { |h, c| c }
+    titlecase = Hash.new { |h, c| c }
+    casefold  = Hash.new { |h, c| c }
+    swapcase  = Hash.new { |h, c| c }
+    turkic_upcase    = Hash.new { |h, c| upcase[c] }
+    turkic_downcase  = Hash.new { |h, c| downcase[c] }
+    turkic_titlecase = Hash.new { |h, c| titlecase[c] }
+    turkic_swapcase  = Hash.new { |h, c| swapcase[c] }
+    ascii_upcase     = Hash.new { |h, c| c =~ /\A[a-zA-Z]\z/ ? upcase[c] : c }
+    ascii_downcase   = Hash.new { |h, c| c =~ /\A[a-zA-Z]\z/ ? downcase[c] : c }
+    ascii_titlecase  = Hash.new { |h, c| c =~ /\A[a-zA-Z]\z/ ? titlecase[c] : c }
+    ascii_swapcase   = Hash.new { |h, c| c=~/\A[a-z]\z/ ? upcase[c] : (c=~/\A[A-Z]\z/ ? downcase[c] : c) }
 
     read_data_file('UnicodeData') do |code, data|
       @@codepoints << code

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

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