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

ruby-changes:66596

From: Jean <ko1@a...>
Date: Fri, 25 Jun 2021 17:29:38 +0900 (JST)
Subject: [ruby-changes:66596] 71344a1d63 (master): [ruby/racc] Stop compressing integer lists

https://git.ruby-lang.org/ruby.git/commit/?id=71344a1d63

From 71344a1d63038aa30328f91a180efb486ae4c19a Mon Sep 17 00:00:00 2001
From: Jean Boussier <jean.boussier@g...>
Date: Mon, 31 May 2021 12:15:56 +0200
Subject: [ruby/racc] Stop compressing integer lists

It is unclear why this was implemented, I assume
it was for performance back in 2006.

However today, this compression defeats bytecode caching
entirely and end up being counter productive.

https://github.com/ruby/racc/commit/ae3703c1d0
---
 lib/racc/parserfilegenerator.rb |   44 -
 test/racc/regress/cast          | 1223 +++++--
 test/racc/regress/huia          |  619 +++-
 test/racc/regress/nasl          | 1122 ++++--
 test/racc/regress/opal          | 7426 +++++++++++++++++++++++++++----------
 test/racc/regress/riml          | 1922 +++++++---
 test/racc/regress/ruby18        | 7193 +++++++++++++++++++++++++++---------
 test/racc/regress/ruby22        | 7654 +++++++++++++++++++++++++++++----------
 8 files changed, 20103 insertions(+), 7100 deletions(-)

diff --git a/lib/racc/parserfilegenerator.rb b/lib/racc/parserfilegenerator.rb
index fb6c209..7131026 100644
--- a/lib/racc/parserfilegenerator.rb
+++ b/lib/racc/parserfilegenerator.rb
@@ -320,50 +320,6 @@ module Racc https://github.com/ruby/ruby/blob/trunk/lib/racc/parserfilegenerator.rb#L320
     end
 
     def integer_list(name, table)
-      if table.size > 2000
-        serialize_integer_list_compressed name, table
-      else
-        serialize_integer_list_std name, table
-      end
-    end
-
-    def serialize_integer_list_compressed(name, table)
-      # TODO: this can be made a LOT more clean with a simple split/map
-      sep  = "\n"
-      nsep = ",\n"
-      buf  = String.new
-      com  = ''
-      ncom = ','
-      co   = com
-      @f.print 'clist = ['
-      table.each do |i|
-        buf << co << i.to_s; co = ncom
-        if buf.size > 66
-          @f.print sep; sep = nsep
-          @f.print "'", buf, "'"
-          buf = String.new
-          co = com
-        end
-      end
-      unless buf.empty?
-        @f.print sep
-        @f.print "'", buf, "'"
-      end
-      line ' ]'
-
-      @f.print(<<-End)
-        #{name} = arr = ::Array.new(#{table.size}, nil)
-        idx = 0
-        clist.each do |str|
-          str.split(',', -1).each do |i|
-            arr[idx] = i.to_i unless i.empty?
-            idx += 1
-          end
-        end
-      End
-    end
-
-    def serialize_integer_list_std(name, table)
       sep = ''
       line "#{name} = ["
       table.each_slice(10) do |ns|
diff --git a/test/racc/regress/cast b/test/racc/regress/cast
index 1892c73..60e92a0 100644
--- a/test/racc/regress/cast
+++ b/test/racc/regress/cast
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/test/racc/regress/cast#L1
 #
 # DO NOT MODIFY!!!!
-# This file is automatically generated by Racc 1.5.0
+# This file is automatically generated by Racc 1.5.2
 # from Racc grammar file "".
 #
 
@@ -375,358 +375,875 @@ restrict return short signed sizeof static struct switch typedef union https://github.com/ruby/ruby/blob/trunk/test/racc/regress/cast#L375
 ...end cast.y/module_eval...
 ##### State transition tables begin ###
 
-clist = [
-'99,100,65,103,108,109,120,312,61,110,111,112,113,114,115,116,117,77',
-'48,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,31,32,33,34,35',
-'36,37,72,281,128,49,38,196,391,123,124,126,127,129,130,131,132,183,277',
-'83,273,84,238,288,293,88,196,72,290,38,274,184,372,373,386,239,240,289',
-'294,71,241,242,50,147,148,149,150,99,100,65,193,108,109,120,50,281,110',
-'111,112,113,114,115,116,117,71,50,10,11,12,13,14,15,16,17,18,19,20,21',
-'22,23,24,25,26,31,32,33,34,35,36,37,56,366,128,89,38,50,169,123,124',
-'126,127,129,130,131,132,99,100,65,88,108,109,120,88,88,110,111,112,113',
-'114,115,116,117,346,349,238,59,68,48,365,195,50,147,148,149,150,38,347',
-'239,240,69,178,283,196,312,366,243,244,48,262,88,128,185,38,263,284',
-'123,124,126,127,129,130,131,132,99,100,65,49,108,109,120,38,50,110,111',
-'112,113,114,115,116,117,281,365,309,440,249,250,49,238,50,147,148,149',
-'150,313,379,196,227,439,178,413,239,240,88,196,50,48,50,196,128,187',
-'38,191,196,123,124,126,127,129,130,131,132,99,100,65,50,108,109,120',
-'416,428,110,111,112,113,114,115,116,117,255,256,192,196,196,197,49,198',
-'50,147,148,149,150,228,229,230,231,232,233,234,235,236,237,43,199,48',
-'241,242,128,202,38,241,242,123,124,126,127,129,130,131,132,99,100,65',
-'50,108,109,120,375,376,110,111,112,113,114,115,116,117,196,196,205,377',
-'387,427,49,433,50,147,148,149,150,196,388,196,437,196,206,445,209,447',
-'450,43,251,48,196,252,128,196,38,196,196,123,124,126,127,129,130,131',
-'132,99,100,65,50,108,109,120,454,253,110,111,112,113,114,115,116,117',
-'196,34,35,36,243,244,49,49,50,147,148,149,150,34,35,36,243,244,254,49',
-'245,246,247,248,67,48,243,244,128,268,38,243,244,123,124,126,127,129',
-'130,131,132,99,100,65,50,108,109,120,249,250,110,111,112,113,114,115',
-'116,117,245,246,247,248,271,272,49,275,50,147,148,149,150,245,246,247',
-'248,285,296,192,303,307,308,314,315,277,50,50,128,50,38,353,355,123',
-'124,126,127,129,130,131,132,99,100,65,50,108,109,120,357,50,110,111',
-'112,113,114,115,116,117,378,389,390,251,281,252,49,253,50,147,148,149',
-'150,254,395,396,397,398,399,405,406,384,384,423,424,425,426,442,128',
-',38,,,123,124,126,127,129,130,131,132,99,100,65,50,108,109,120,,,110',
-'111,112,113,114,115,116,117,,,,,,,,,50,147,148,149,150,,,,,,,,,,,,,',
-',,128,,38,,,123,124,126,127,129,130,131,132,99,100,65,,108,109,120,',
-',110,111,112,113,114,115,116,117,,,,,,,,,50,147,148,149,150,,,,,,,,',
-',,,,,,,128,,38,,,123,124,126,127,129,130,131,132,99,100,65,,108,109',
-'120,,,110,111,112,113,114,115,116,117,,,,,,,,,50,147,148,149,150,,,',
-',,,,,,,,,,,,128,,38,,,123,124,126,127,129,130,131,132,99,100,65,,108',
-'109,120,,,110,111,112,113,114,115,116,117,,,,,,,,,50,147,148,149,150',
-',,,,,,,,,,,,,,,128,,38,,,123,124,126,127,129,130,131,132,99,100,65,',
-'108,109,120,,,110,111,112,113,114,115,116,117,,,,,,,,,50,147,148,149',
-'150,,,,,,,,,,,,,,,,128,,38,,,123,124,126,127,129,130,131,132,99,100',
-'65,,108,109,120,,,110,111,112,113,114,115,116,117,,,,,,,,,50,147,148',
-'149,150,,,,,,,,,,,,,,,,128,,38,,,123,124,126,127,129,130,131,132,99',
-'100,65,,108,109,120,,,110,111,112,113,114,115,116,117,,,,,,,,,50,147',
-'148,149,150,,,,,,,,,,,,,,,,128,,38,,,123,124,126,127,129,130,131,132',
-'99,100,65,,108,109,120,,,110,111,112,113,114,115,116,117,,,,,,,,,50',
-'147,148,149,150,,,,,,,,,,,,,,,,128,,38,,,123,124,126,127,129,130,131',
-'132,99,100,65,,108,109,120,,,110,111,112,113,114,115,116,117,,,,,,,',
-',50,147,148,149,150,,,,,,,,,,,,,,,,128,,38,,,123,124,126,127,129,130',
-'131,132,99,100,65,,108,109,120,,,110,111,112,113,114,115,116,117,,,',
-',,,,,50,147,148,149,150,,,,,,,,,,,,,,,,128,,38,,,123,124,126,127,129',
-'130,131,132,99,100,65,,108,109,120,,,110,111,112,113,114,115,116,117',
-',,,,,,,,50,147,148,149,150,,,,,,,,,,,,,,,,128,,38,,,123,124,126,127',
-'129,130,131,132,99,100,65,,108,109,120,,,110,111,112,113,114,115,116',
-'117,,,,,,,,,50,147,148,149,150,,,,,,,,,,,,,,,,128,,38,,,123,124,126',
-'127,129,130,131,132,99,100,65,,108,109,120,,,110,111,112,113,114,115',
-'116,117,,,,,,,,,50,147,148,149,150,,,,,,,,,,,,,,,,128,,38,,,123,124',
-'126,127,129,130,131,132,99,100,65,,108,109,120,,,110,111,112,113,114',
-'115,116,117,154,,,,120,,,,50,147,148,149,150,,,,,,,215,,,,,,,,,128,',
-'38,,,123,124,126,127,129,130,131,132,,,128,,,,,123,124,126,127,129,130',
-'131,132,214,,,,,216,217,218,219,,50,147,148,149,150,65,,,,120,,,,,,50',
-'147,148,149,150,154,,,,120,,,15,16,17,18,19,20,21,22,23,24,25,26,31',
-'32,33,34,35,36,,,,128,,38,,,123,124,126,127,129,130,131,132,262,,128',
-',,263,,123,124,126,127,129,130,131,132,,,,,,,,,,,50,147,148,149,150',
-'65,,,,120,,,,,,50,147,148,149,150,,,,,,,,15,16,17,18,19,20,21,22,23',
-'24,25,26,31,32,33,34,35,36,,,,128,,38,,,123,124,126,127,129,130,131',
-'132,,,,,,,,,65,,,,120,,,,,,,,,,,,,50,147,148,149,150,15,16,17,18,19',
-'20,21,22,23,24,25,26,31,32,33,34,35,36,,,,128,,38,,,123,124,126,127',
-'129,130,131,132,154,,,,120,,,,,,,,,384,,,,120,,,,,,,,50,147,148,149',
-'150,,,,,,,,,,,,,,128,,,,,123,124,126,127,129,130,131,132,128,,,,,123',
-'124,126,127,129,130,131,132,154,392,,,120,,,,,,,,50,147,148,149,150',
-'154,,,,120,,,,50,147,148,149,150,,,,,,,,,,,,262,,128,,,263,,123,124',
-'126,127,129,130,131,132,,,262,,128,,,263,,123,124,126,127,129,130,131',
-'132,154,,,,120,,,,50,147,148,149,150,,,154,453,,,120,,,,,,50,147,148',
-'149,150,,,,,,,,,,,,,,128,,,,,123,124,126,127,129,130,131,132,262,,128',
-',208,263,120,123,124,126,127,129,130,131,132,,,,,,,,,,,50,147,148,149',
-'150,,,,,,,,,,,50,147,148,149,150,128,,,,,123,124,126,127,129,130,131',
-'132,,,,,,,,,,,,,,,,305,,120,,,,,,,,50,147,148,149,150,10,11,12,13,14',
-'15,16,17,18,19,20,21,22,23,24,25,26,31,32,33,34,35,36,37,,,128,,38,',
-',123,124,126,127,129,130,131,132,381,,120,,,,,,,,,,,383,,120,,,,,,,',
-',,50,147,148,149,150,,,,,,,,,,,,128,,,,,123,124,126,127,129,130,131',
-'132,128,,412,,120,123,124,126,127,129,130,131,132,,,,,,,,,,,,,50,147',
-'148,149,150,,,,,,,,,50,147,148,149,150,128,,,,,123,124,126,127,129,130',
-'131,132,120,,,,,,,,,,,,,120,,160,,,,,,,,,,50,147,148,149,150,,,,34,35',
-'36,,,159,161,,,,,123,124,126,127,129,130,131,132,128,,,,220,123,124',
-'126,127,129,130,131,132,,,,,220,,,,,,,,50,147,148,149,150,,,,,,,,,50',
-'147,148,149,150,128,,,,,123,124,126,127,129,130,131,132,128,,,,120,123',
-'124,126,127,129,130,131,132,,,,,224,,,,,,,,50,147,148,149,150,,,,,,',
-',,50,147,148,149,150,128,,,,,123,124,126,127,129,130,131,132,128,,,',
-',123,124,126,127,129,130,131,132,,,120,,,,,,,,,,50,147,148,149,150,266',
-',,,120,,,,50,147,148,149,150,,,,,,34,35,36,,,265,267,,,,120,123,124',
-'126,127,129,130,131,132,34,35,36,,,,128,,,,120,123,124,126,127,129,130',
-'131,132,,,,,,,50,147,148,149,150,128,,,,120,123,124,126,127,129,130',
-'131,132,,50,147,148,149,150,128,,,,120,123,124,126,127,129,130,131,132',
-',,,,,,50,147,148,149,150,128,,,,120,123,124,126,127, (... truncated)

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

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