diff options
author | Jean Boussier <jean.boussier@gmail.com> | 2021-05-31 12:15:56 +0200 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2021-06-25 17:23:06 +0900 |
commit | 71344a1d63038aa30328f91a180efb486ae4c19a (patch) | |
tree | 1593782d0d9474d8e1b4c6fea392d2e1077691f1 /lib/racc | |
parent | be230615d016e27d5b45b465d1481f6ecf7f1d28 (diff) |
[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
Diffstat (limited to 'lib/racc')
-rw-r--r-- | lib/racc/parserfilegenerator.rb | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/lib/racc/parserfilegenerator.rb b/lib/racc/parserfilegenerator.rb index fb6c209536..7131026929 100644 --- a/lib/racc/parserfilegenerator.rb +++ b/lib/racc/parserfilegenerator.rb @@ -320,50 +320,6 @@ module Racc 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| |