Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change String not to be reassigned #428

Merged
merged 1 commit into from
Jun 5, 2024
Merged

Conversation

ydah
Copy link
Collaborator

@ydah ydah commented Jun 3, 2024

Follow up: #424

@junk0612
Copy link
Collaborator

junk0612 commented Jun 3, 2024

I think this change is something that should be considered.
I don't think the behavior will change, but I am not sure if it will not impact execution speed or memory usage.

WDYT? @ydah

@ydah
Copy link
Collaborator Author

ydah commented Jun 5, 2024

Memory usage

Verification Procedure

  1. Make the following changes
diff --git a/Gemfile b/Gemfile
index 9ae5b9fd48..5af7508578 100644
--- a/Gemfile
+++ b/Gemfile
@@ -8,6 +8,7 @@ gem "rake"
 gem "rspec"
 gem "simplecov", require: false
 gem "stackprof", platforms: [:ruby] # stackprof doesn't support Windows
+gem "memory_profiler"
 
 # Recent steep requires Ruby >= 3.0.0.
 # Then skip install on some CI jobs.
diff --git a/exe/lrama b/exe/lrama
index ba5fb06c82..f697492921 100755
--- a/exe/lrama
+++ b/exe/lrama
@@ -2,5 +2,8 @@
 
 $LOAD_PATH << File.join(__dir__, "../lib")
 require "lrama"
-
-Lrama::Command.new.run(ARGV.dup)
+require 'memory_profiler'
+report = MemoryProfiler.report do
+  Lrama::Command.new.run(ARGV.dup)
+end
+report.pretty_print
  1. Create parse.tmp.y in ruby/ruby
ruby tool/id2token.rb parse.y > parse.tmp.y
cp parse.tmp.y dir/lrama/tmp
  1. Execute the following command
exe/lrama -o parse.tmp.c --header=parse.tmp.h tmp/parse.tmp.y > before

Summary

Before

Total allocated: 3302455861 bytes (6836404 objects)
Total retained:  592 bytes (4 objects)

After

Total allocated: 3310825264 bytes (7009251 objects)
Total retained:  592 bytes (4 objects)

Full Report

Much of the memory appears to be used by lexer.rb. From an overall perspective, there does not appear to be that much change.

Full Report Before ``` Total allocated: 3302455861 bytes (6836404 objects) Total retained: 592 bytes (4 objects)

allocated memory by gem

3300045820 lrama/lib
1173265 erb
569432 other
309080 forwardable
288312 set
69952 optparse

allocated memory by file

2960603032 /ydah/lrama/lib/lrama/lexer.rb
149146776 /ydah/lrama/lib/lrama/states.rb
119310360 /ydah/lrama/lib/lrama/bitmap.rb
18793091 /ydah/lrama/lib/lrama/output.rb
15609824 /ydah/lrama/lib/lrama/context.rb
13551480 /ydah/lrama/lib/lrama/states/item.rb
9516328 /ydah/lrama/lib/lrama/state.rb
4355880 /ydah/lrama/lib/lrama/lexer/token/user_code.rb
2996752 /ydah/lrama/lib/lrama/digraph.rb
1260152 /ydah/lrama/lib/lrama/grammar.rb
1165664 /ydah/lrama/lib/lrama/grammar/rule_builder.rb
1108808 /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb
736432 /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb/compiler.rb
518656 /ydah/lrama/lib/lrama/lexer/grammar_file.rb
469809 /ydah/lrama/lib/lrama/grammar/code.rb
436833 /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb.rb
332296 racc/parser.rb
330592 /ydah/lrama/lib/lrama/grammar/symbol.rb
326800 /ydah/lrama/lib/lrama/grammar/rule.rb
309080 /.rbenv/versions/3.3.0/lib/ruby/3.3.0/forwardable.rb
290320 /ydah/lrama/lib/lrama/grammar/parameterizing_rule/resolver.rb
288312 /.rbenv/versions/3.3.0/lib/ruby/3.3.0/set.rb
192584 parser.y
146040 /ydah/lrama/lib/lrama/grammar/code/rule_action.rb
120344 /ydah/lrama/lib/lrama/state/reduce.rb
112240 /ydah/lrama/lib/lrama/lexer/token.rb
98640 /ydah/lrama/lib/lrama/grammar/printer.rb
92440 /ydah/lrama/lib/lrama/lexer/token/tag.rb
69952 /.rbenv/versions/3.3.0/lib/ruby/3.3.0/optparse.rb
50240 /ydah/lrama/lib/lrama/grammar/code/printer_code.rb
46080 /ydah/lrama/lib/lrama/grammar/binding.rb
22560 internal:prelude
16544 /ydah/lrama/template/bison/_yacc.h
11040 /ydah/lrama/lib/lrama/grammar/parameterizing_rule/rhs.rb
10584 /ydah/lrama/lib/lrama/command.rb
2720 internal:timev
2688 /ydah/lrama/lib/lrama/option_parser.rb
2496 /ydah/lrama/template/bison/yacc.c
720 /ydah/lrama/lib/lrama/grammar/destructor.rb
320 /ydah/lrama/lib/lrama/grammar/code/destructor_code.rb
152 exe/lrama
80 /ydah/lrama/lib/lrama/warning.rb
80 /ydah/lrama/template/bison/yacc.h
40 /ydah/lrama/lib/lrama/grammar/union.rb

allocated memory by location

1336343436 /ydah/lrama/lib/lrama/lexer.rb:147
1135418426 /ydah/lrama/lib/lrama/lexer.rb:155
175637082 /ydah/lrama/lib/lrama/lexer.rb:141
175124358 /ydah/lrama/lib/lrama/lexer.rb:134
53366600 /ydah/lrama/lib/lrama/bitmap.rb:20
53366600 /ydah/lrama/lib/lrama/bitmap.rb:25
51743561 /ydah/lrama/lib/lrama/lexer.rb:153
50637200 /ydah/lrama/lib/lrama/states.rb:208
42488960 /ydah/lrama/lib/lrama/states.rb:389
42095519 /ydah/lrama/lib/lrama/lexer.rb:150
23083920 /ydah/lrama/lib/lrama/states.rb:417
19882444 /ydah/lrama/lib/lrama/lexer.rb:144
9854973 /ydah/lrama/lib/lrama/lexer.rb:98
8788960 /ydah/lrama/lib/lrama/context.rb:269
8342000 /ydah/lrama/lib/lrama/states/item.rb:56
7296680 /ydah/lrama/lib/lrama/bitmap.rb:16
6487552 /ydah/lrama/lib/lrama/states.rb:416
6388378 /ydah/lrama/lib/lrama/lexer.rb:96
6300800 /ydah/lrama/lib/lrama/output.rb:406
5280480 /ydah/lrama/lib/lrama/bitmap.rb:9
3927992 /ydah/lrama/lib/lrama/output.rb:485
3384960 /ydah/lrama/lib/lrama/states/item.rb:32
3367480 /ydah/lrama/lib/lrama/lexer/token/user_code.rb:28
2698015 /ydah/lrama/lib/lrama/lexer.rb:159
2350912 /ydah/lrama/lib/lrama/context.rb:268
2253448 /ydah/lrama/lib/lrama/output.rb:402
2134560 /ydah/lrama/lib/lrama/states.rb:349
2024320 /ydah/lrama/lib/lrama/state.rb:57
1890496 /ydah/lrama/lib/lrama/states.rb:195
1890496 /ydah/lrama/lib/lrama/states.rb:196
1865632 /ydah/lrama/lib/lrama/context.rb:222
1716680 /ydah/lrama/lib/lrama/states/item.rb:44
1584000 /ydah/lrama/lib/lrama/states.rb:370
1584000 /ydah/lrama/lib/lrama/states.rb:372
1584000 /ydah/lrama/lib/lrama/states.rb:394
1584000 /ydah/lrama/lib/lrama/states.rb:398
1583240 /ydah/lrama/lib/lrama/states.rb:400
1583240 /ydah/lrama/lib/lrama/states.rb:401
1515984 /ydah/lrama/lib/lrama/output.rb:486
1394640 /ydah/lrama/lib/lrama/states.rb:294
1298240 /ydah/lrama/lib/lrama/output.rb:487
1280032 /ydah/lrama/lib/lrama/state.rb:54
1271128 /ydah/lrama/lib/lrama/state.rb:84
1252800 /ydah/lrama/lib/lrama/lexer.rb:68
1160800 /ydah/lrama/lib/lrama/digraph.rb:41
1094520 /ydah/lrama/lib/lrama/lexer.rb:154
1078400 /ydah/lrama/lib/lrama/state.rb:22
1078400 /ydah/lrama/lib/lrama/state.rb:40
1067280 /ydah/lrama/lib/lrama/states.rb:351
1067280 /ydah/lrama/lib/lrama/states.rb:354

allocated memory by class

2959325947 String
129223456 Array
116655560 Integer
59981872 Hash
20771722 Regexp
11795880 Lrama::States::Item
1261320 Range
1012160 Lrama::State::Shift
446160 MatchData
373280 Enumerator
250560 Lrama::Lexer::Location
215728 Lrama::State
186560 Lrama::Grammar::Reference
147640 Lrama::Lexer::Token::Ident
128744 Lrama::Grammar::Rule
125920 Lrama::Grammar::RuleBuilder
114208 Lrama::State::Reduce
106304 StringScanner
80160 Lrama::State::ResolvedConflict
71840 Lrama::Grammar::Symbol
48992 Lrama::Lexer::Token::UserCode
29080 Set
23680 Lrama::Grammar::Code::RuleAction
18120 File
10960 Lrama::Grammar::Code::PrinterCode
8840 Lrama::Lexer::Token::Char
8584 Lrama::Lexer::Token::InstantiateRule
8120 Lrama::Grammar::Type
4280 Lrama::Lexer::Token::Tag
3400 Lrama::Grammar::Binding
2720 Time
1920 Lrama::Grammar::Precedence
1520 Proc
1408 OptionParser::OptionMap
1040 Lrama::Grammar::ParameterizingRule::Rule
992 Lrama::Grammar
800 Lrama::Grammar::ParameterizingRule::Rhs
640 OptionParser::Switch::NoArgument
576 Racc::CparseParams
480 OptionParser::Switch::RequiredArgument
368 Lrama::Parser
264 Binding
240 ERB
240 ERB::Compiler
240 ERB::Compiler::ExplicitScanner
240 OptionParser::Switch::OptionalArgument
208 Lrama::Context
200 Lrama::Grammar::Printer
160 Lrama::Digraph
160 Lrama::Grammar::Auxiliary

allocated objects by gem

6812590 lrama/lib
11206 other
5991 erb
4253 forwardable
1454 set
910 optparse

allocated objects by file

2814507 /ydah/lrama/lib/lrama/bitmap.rb
2629522 /ydah/lrama/lib/lrama/states.rb
378942 /ydah/lrama/lib/lrama/lexer.rb
252428 /ydah/lrama/lib/lrama/context.rb
213657 /ydah/lrama/lib/lrama/states/item.rb
182136 /ydah/lrama/lib/lrama/output.rb
146596 /ydah/lrama/lib/lrama/state.rb
95722 /ydah/lrama/lib/lrama/lexer/token/user_code.rb
29026 /ydah/lrama/lib/lrama/digraph.rb
21145 /ydah/lrama/lib/lrama/grammar.rb
18584 /ydah/lrama/lib/lrama/grammar/rule_builder.rb
8235 racc/parser.rb
5558 /ydah/lrama/lib/lrama/grammar/code.rb
4388 /ydah/lrama/lib/lrama/grammar/symbol.rb
4253 /.rbenv/versions/3.3.0/lib/ruby/3.3.0/forwardable.rb
3440 /ydah/lrama/lib/lrama/grammar/rule.rb
3163 /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb/compiler.rb
2828 /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb.rb
2806 /ydah/lrama/lib/lrama/lexer/token.rb
2690 /ydah/lrama/lib/lrama/grammar/code/rule_action.rb
2540 /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb
2408 /ydah/lrama/lib/lrama/state/reduce.rb
2315 parser.y
2311 /ydah/lrama/lib/lrama/lexer/token/tag.rb
1905 /ydah/lrama/lib/lrama/grammar/parameterizing_rule/resolver.rb
1454 /.rbenv/versions/3.3.0/lib/ruby/3.3.0/set.rb
910 /.rbenv/versions/3.3.0/lib/ruby/3.3.0/optparse.rb
822 /ydah/lrama/lib/lrama/grammar/printer.rb
672 /ydah/lrama/lib/lrama/grammar/binding.rb
628 /ydah/lrama/lib/lrama/grammar/code/printer_code.rb
564 internal:prelude
92 /ydah/lrama/lib/lrama/grammar/parameterizing_rule/rhs.rb
50 /ydah/lrama/template/bison/yacc.c
34 internal:timev
31 /ydah/lrama/lib/lrama/option_parser.rb
17 /ydah/lrama/lib/lrama/command.rb
6 /ydah/lrama/lib/lrama/grammar/destructor.rb
4 /ydah/lrama/lib/lrama/grammar/code/destructor_code.rb
4 /ydah/lrama/lib/lrama/lexer/grammar_file.rb
4 /ydah/lrama/template/bison/_yacc.h
2 /ydah/lrama/lib/lrama/warning.rb
2 /ydah/lrama/template/bison/yacc.h
2 exe/lrama
1 /ydah/lrama/lib/lrama/grammar/union.rb

allocated objects by location

1334165 /ydah/lrama/lib/lrama/bitmap.rb:20
1334165 /ydah/lrama/lib/lrama/bitmap.rb:25
1062224 /ydah/lrama/lib/lrama/states.rb:389
577098 /ydah/lrama/lib/lrama/states.rb:417
506372 /ydah/lrama/lib/lrama/states.rb:208
219724 /ydah/lrama/lib/lrama/context.rb:269
170656 /ydah/lrama/lib/lrama/lexer.rb:144
132012 /ydah/lrama/lib/lrama/bitmap.rb:9
84624 /ydah/lrama/lib/lrama/states/item.rb:32
84187 /ydah/lrama/lib/lrama/lexer/token/user_code.rb:28
83420 /ydah/lrama/lib/lrama/states/item.rb:56
53364 /ydah/lrama/lib/lrama/states.rb:349
50608 /ydah/lrama/lib/lrama/state.rb:57
44449 /ydah/lrama/lib/lrama/lexer.rb:96
43367 /ydah/lrama/lib/lrama/output.rb:402
42917 /ydah/lrama/lib/lrama/states/item.rb:44
39600 /ydah/lrama/lib/lrama/states.rb:370
39600 /ydah/lrama/lib/lrama/states.rb:372
39600 /ydah/lrama/lib/lrama/states.rb:394
39600 /ydah/lrama/lib/lrama/states.rb:398
39581 /ydah/lrama/lib/lrama/states.rb:400
39581 /ydah/lrama/lib/lrama/states.rb:401
39380 /ydah/lrama/lib/lrama/output.rb:406
30700 /ydah/lrama/lib/lrama/output.rb:486
29822 /ydah/lrama/lib/lrama/output.rb:487
29020 /ydah/lrama/lib/lrama/digraph.rb:41
28266 /ydah/lrama/lib/lrama/lexer.rb:147
27198 /ydah/lrama/lib/lrama/output.rb:485
26682 /ydah/lrama/lib/lrama/states.rb:351
26682 /ydah/lrama/lib/lrama/states.rb:354
26652 /ydah/lrama/lib/lrama/state.rb:54
26652 /ydah/lrama/lib/lrama/state.rb:84
26082 /ydah/lrama/lib/lrama/lexer.rb:155
25304 /ydah/lrama/lib/lrama/state.rb:48
23957 /ydah/lrama/lib/lrama/states.rb:183
22680 /ydah/lrama/lib/lrama/lexer.rb:98
22106 /ydah/lrama/lib/lrama/states.rb:282
14165 /ydah/lrama/lib/lrama/bitmap.rb:16
14133 /ydah/lrama/lib/lrama/lexer.rb:146
13883 /ydah/lrama/lib/lrama/states.rb:416
13041 /ydah/lrama/lib/lrama/lexer.rb:154
11053 /ydah/lrama/lib/lrama/context.rb:301
11053 /ydah/lrama/lib/lrama/states.rb:294
11053 /ydah/lrama/lib/lrama/states.rb:298
11053 /ydah/lrama/lib/lrama/states.rb:322
11053 /ydah/lrama/lib/lrama/states.rb:380
9396 /ydah/lrama/lib/lrama/lexer.rb:68
8512 /ydah/lrama/lib/lrama/lexer.rb:113
8235 racc/parser.rb:272
7874 /ydah/lrama/lib/lrama/states.rb:353

allocated objects by class

2916389 Integer
2622328 Array
562343 String
324244 Hash
294897 Lrama::States::Item
36538 Regexp
31533 Range
25304 Lrama::State::Shift
3330 MatchData
3132 Lrama::Lexer::Location
2357 Lrama::Lexer::Token::Ident
2333 Enumerator
2332 Lrama::Grammar::Reference
1348 Lrama::State
1204 Lrama::State::Reduce
1002 Lrama::State::ResolvedConflict
788 Lrama::Grammar::Rule
787 Lrama::Grammar::RuleBuilder
727 Set
616 Lrama::Lexer::Token::UserCode
604 StringScanner
592 Lrama::Grammar::Code::RuleAction
449 Lrama::Grammar::Symbol
274 Lrama::Grammar::Code::PrinterCode
221 Lrama::Lexer::Token::Char
203 Lrama::Grammar::Type
107 Lrama::Lexer::Token::InstantiateRule
107 Lrama::Lexer::Token::Tag
85 Lrama::Grammar::Binding
48 Lrama::Grammar::Precedence
34 Time
20 Lrama::Grammar::ParameterizingRule::Rhs
19 Proc
13 Lrama::Grammar::ParameterizingRule::Rule
8 OptionParser::Switch::NoArgument
7 File
6 OptionParser::Switch::RequiredArgument
5 Lrama::Grammar::Printer
4 Lrama::Grammar::Code::NoReferenceCode
4 Lrama::Grammar::Counter
4 OptionParser::OptionMap
3 Binding
3 ERB
3 ERB::Compiler
3 ERB::Compiler::Buffer
3 ERB::Compiler::ExplicitScanner
3 OptionParser::Switch::OptionalArgument
2 Lrama::Digraph
2 Lrama::Grammar
2 Lrama::Grammar::Auxiliary

retained memory by gem

   256  erb
   256  lrama/lib
    80  other

retained memory by file

   256  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb/compiler.rb
   256  /ydah/lrama/lib/lrama/states.rb
    80  racc/parser.rb

retained memory by location

   256  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb/compiler.rb:394
   256  /ydah/lrama/lib/lrama/states.rb:209
    80  racc/parser.rb:272

retained memory by class

   512  Hash
    80  String

retained objects by gem

     2  other
     1  erb
     1  lrama/lib

retained objects by file

     2  racc/parser.rb
     1  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb/compiler.rb
     1  /ydah/lrama/lib/lrama/states.rb

retained objects by location

     2  racc/parser.rb:272
     1  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb/compiler.rb:394
     1  /ydah/lrama/lib/lrama/states.rb:209

retained objects by class

     2  Hash
     2  String

Allocated String Report

 74346  "\\Z"
 74345  /ydah/lrama/lib/lrama/lexer.rb:144
     1  parser.y:510

 57126  " "
 54747  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:28
  2054  /ydah/lrama/lib/lrama/lexer.rb:80
   288  /ydah/lrama/lib/lrama/lexer.rb:175
    30  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb/compiler.rb:378
     2  /ydah/lrama/lib/lrama/lexer.rb:154
     2  /ydah/lrama/lib/lrama/lexer.rb:155
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:200
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:225
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:226

 37918  "\n"
 14670  /ydah/lrama/lib/lrama/lexer.rb:147
 14133  /ydah/lrama/lib/lrama/lexer.rb:146
  2472  /ydah/lrama/lib/lrama/output.rb:485
  2252  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:28
  2146  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb.rb:429
  2056  /ydah/lrama/lib/lrama/lexer.rb:78
    85  /ydah/lrama/lib/lrama/lexer.rb:170
    63  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb/compiler.rb:262
    21  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb/compiler.rb:306
     6  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb/compiler.rb:255
     6  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb/compiler.rb:367
     6  /ydah/lrama/lib/lrama/lexer.rb:85
     2  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb/compiler.rb:254

 36624  ""
 28443  /ydah/lrama/lib/lrama/lexer.rb:144
  5251  /ydah/lrama/lib/lrama/lexer.rb:96
  2811  /ydah/lrama/lib/lrama/lexer.rb:98
    28  /ydah/lrama/lib/lrama/lexer.rb:156
    27  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb/compiler.rb:388
    16  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb/compiler.rb:255
    14  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb/compiler.rb:306
    14  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb/compiler.rb:367
     6  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb/compiler.rb:354
     3  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb.rb:429
     3  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb/compiler.rb:322
     2  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb/compiler.rb:257
     2  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb/compiler.rb:290
     2  /ydah/lrama/lib/lrama/output.rb:433
     2  parser.y:29

 31507  "%{|%}|%%|{|}|\\[|\\]|\\(|\\)|\\,|:|\\||;"
 31507  /ydah/lrama/lib/lrama/lexer.rb:96

 26944  "\"parse.tmp.c\""
 26944  /ydah/lrama/lib/lrama/output.rb:487

 25515  "}"
 19312  /ydah/lrama/lib/lrama/lexer.rb:144
  2177  /ydah/lrama/lib/lrama/lexer.rb:136
  1581  /ydah/lrama/lib/lrama/lexer.rb:141
  1192  /ydah/lrama/lib/lrama/lexer.rb:97
   596  /ydah/lrama/lib/lrama/lexer.rb:96
   574  parser.y:469
    58  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:28
    11  parser.y:303
     5  parser.y:111
     2  parser.y:362
     2  parser.y:79
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:200
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:225
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:226
     1  parser.y:64
     1  parser.y:95

 20118  "%}"
 20114  /ydah/lrama/lib/lrama/lexer.rb:144
     2  /ydah/lrama/lib/lrama/lexer.rb:97
     1  /ydah/lrama/lib/lrama/lexer.rb:96
     1  parser.y:16

 16867  "%union|%token|%type|%left|%right|%nonassoc|%expect|%define|%require|%printer|%destructor|%lex-param|%parse-param|%initial-action|%precedence|%prec|%error-token|%before-reduce|%after-reduce|%after-shif"
 16867  /ydah/lrama/lib/lrama/lexer.rb:98

  8816  "     0,"
  8816  /ydah/lrama/lib/lrama/output.rb:406

  8414  "    -1,"
  8414  /ydah/lrama/lib/lrama/output.rb:406

  5010  "{"
  1581  /ydah/lrama/lib/lrama/lexer.rb:133
  1581  /ydah/lrama/lib/lrama/lexer.rb:134
  1192  /ydah/lrama/lib/lrama/lexer.rb:97
   596  /ydah/lrama/lib/lrama/lexer.rb:96
    57  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:28
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:200
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:225
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:226

  2117  ";"
  1116  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:28
   488  /ydah/lrama/lib/lrama/lexer.rb:97
   244  /ydah/lrama/lib/lrama/lexer.rb:96
   133  /ydah/lrama/lib/lrama/lexer.rb:154
   133  /ydah/lrama/lib/lrama/lexer.rb:155
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:200
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:225
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:226

  2102  "                    "
   536  /ydah/lrama/lib/lrama/lexer.rb:154
   536  /ydah/lrama/lib/lrama/lexer.rb:155
   518  /ydah/lrama/lib/lrama/lexer.rb:80
   512  /ydah/lrama/lib/lrama/output.rb:267

  1894  "_"
  1795  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:28
    99  /ydah/lrama/lib/lrama/lexer.rb:175

  1885  ","
  1761  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:28
    33  /ydah/lrama/lib/lrama/lexer.rb:154
    33  /ydah/lrama/lib/lrama/lexer.rb:155
    26  /ydah/lrama/lib/lrama/lexer.rb:97
    16  /ydah/lrama/lib/lrama/lexer.rb:175
    13  /ydah/lrama/lib/lrama/lexer.rb:96
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:200
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:225
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:226

  1756  "#line [@oline@] [@ofile@]\n"
  1756  /ydah/lrama/lib/lrama/output.rb:486

  1721  "e"
  1539  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:28
   181  /ydah/lrama/lib/lrama/lexer.rb:175
     1  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/optparse.rb:1497

  1526  "|"
  1008  /ydah/lrama/lib/lrama/lexer.rb:97
   504  /ydah/lrama/lib/lrama/lexer.rb:96
    11  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:28
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:200
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:225
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:226

  1467  "node"
  1467  /ydah/lrama/lib/lrama/lexer/token/tag.rb:9

  1341  "p"
  1200  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:28
    96  /ydah/lrama/lib/lrama/lexer.rb:175
    45  /ydah/lrama/lib/lrama/output.rb:327

  1299  ")"
  1053  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:28
   144  /ydah/lrama/lib/lrama/lexer.rb:97
    72  /ydah/lrama/lib/lrama/lexer.rb:96
    15  /ydah/lrama/lib/lrama/lexer.rb:175
     6  /ydah/lrama/lib/lrama/lexer.rb:154
     6  /ydah/lrama/lib/lrama/lexer.rb:155
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:200
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:225
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:226

  1288  "("
  1054  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:28
   144  /ydah/lrama/lib/lrama/lexer.rb:97
    72  /ydah/lrama/lib/lrama/lexer.rb:96
    15  /ydah/lrama/lib/lrama/lexer.rb:175
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:200
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:225
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:226

  1286  "n"
  1139  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:28
   147  /ydah/lrama/lib/lrama/lexer.rb:175

  1186  "a"
  1078  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:28
   108  /ydah/lrama/lib/lrama/lexer.rb:175

  1085  ":"
   484  /ydah/lrama/lib/lrama/lexer.rb:97
   242  /ydah/lrama/lib/lrama/lexer.rb:96
   126  /ydah/lrama/lib/lrama/lexer.rb:154
   126  /ydah/lrama/lib/lrama/lexer.rb:155
    52  /ydah/lrama/lib/lrama/lexer.rb:175
    48  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:28
     4  /ydah/lrama/lib/lrama/lexer.rb:115
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:200
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:225
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:226

  1039  "t"
   938  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:28
    99  /ydah/lrama/lib/lrama/lexer.rb:175
     1  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/optparse.rb:1497
     1  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/optparse.rb:866

   995  "r"
   846  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:28
   148  /ydah/lrama/lib/lrama/lexer.rb:175
     1  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/optparse.rb:1497

   925  "1"
   696  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:45
   158  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:58
    56  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:28
    14  /ydah/lrama/lib/lrama/lexer.rb:175
     1  /ydah/lrama/lib/lrama/grammar/rule_builder.rb:165

   896  "s"
   822  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:28
    74  /ydah/lrama/lib/lrama/lexer.rb:175

   885  "o"
   771  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:28
   111  /ydah/lrama/lib/lrama/lexer.rb:175
     1  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/optparse.rb:1497
     1  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/optparse.rb:1663
     1  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/optparse.rb:866

   852  "    "
   424  /ydah/lrama/lib/lrama/lexer.rb:154
   424  /ydah/lrama/lib/lrama/lexer.rb:155
     3  /ydah/lrama/lib/lrama/lexer.rb:80
     1  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/optparse.rb:1143

   850  "i"
   762  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:28
    88  /ydah/lrama/lib/lrama/lexer.rb:175

   849  "}\n"
   849  /ydah/lrama/lib/lrama/output.rb:485

   829  "="
   816  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:28
    10  /ydah/lrama/lib/lrama/lexer.rb:175
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:200
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:225
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:226

   787  " -1113,"
   787  /ydah/lrama/lib/lrama/output.rb:406

   778  "                "
   691  /ydah/lrama/lib/lrama/lexer.rb:80
    43  /ydah/lrama/lib/lrama/lexer.rb:154
    43  /ydah/lrama/lib/lrama/lexer.rb:155
     1  /ydah/lrama/lib/lrama/output.rb:267

   768  "l"
   717  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:28
    51  /ydah/lrama/lib/lrama/lexer.rb:175

   758  "    }\n"
   758  /ydah/lrama/lib/lrama/output.rb:485

   696  "d"
   646  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:28
    48  /ydah/lrama/lib/lrama/lexer.rb:175
     1  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/optparse.rb:1497
     1  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/optparse.rb:866

   673  "        "
   305  /ydah/lrama/lib/lrama/lexer.rb:154
   305  /ydah/lrama/lib/lrama/lexer.rb:155
    62  /ydah/lrama/lib/lrama/lexer.rb:80
     1  /ydah/lrama/lib/lrama/output.rb:267

   662  "&"
   659  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:28
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:200
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:225
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:226

   659  "$$"
   659  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:40

   612  "c"
   569  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:28
    43  /ydah/lrama/lib/lrama/lexer.rb:175

   608  "E"
   608  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:28

   592  "    break;\n"
   592  /ydah/lrama/lib/lrama/output.rb:485

   586  "{\n"
   586  /ydah/lrama/lib/lrama/output.rb:485

   570  "2"
   388  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:45
   124  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:58
    51  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:28
     4  /ydah/lrama/lib/lrama/lexer.rb:175
     2  /ydah/lrama/lib/lrama/output.rb:486
     1  /ydah/lrama/lib/lrama/grammar/rule_builder.rb:165

   558  "/*"
   506  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:25
    40  /ydah/lrama/lib/lrama/lexer.rb:82
     6  /ydah/lrama/lib/lrama/lexer.rb:154
     6  /ydah/lrama/lib/lrama/lexer.rb:155

   535  "                    }\n"
   535  /ydah/lrama/lib/lrama/output.rb:485

Retained String Report

     1  "@tstack"
     1  racc/parser.rb:272

     1  "@vstack"
     1  racc/parser.rb:272

After

Total allocated: 3310825264 bytes (7009251 objects)
Total retained: 592 bytes (4 objects)

allocated memory by gem

3308414383 lrama/lib
1173265 erb
569432 other
309080 forwardable
288312 set
70792 optparse

allocated memory by file

2960994352 /ydah/lrama/lib/lrama/lexer.rb
149146776 /ydah/lrama/lib/lrama/states.rb
119310360 /ydah/lrama/lib/lrama/bitmap.rb
26231014 /ydah/lrama/lib/lrama/output.rb
15610024 /ydah/lrama/lib/lrama/context.rb
13551480 /ydah/lrama/lib/lrama/states/item.rb
9516328 /ydah/lrama/lib/lrama/state.rb
4398400 /ydah/lrama/lib/lrama/lexer/token/user_code.rb
2996752 /ydah/lrama/lib/lrama/digraph.rb
1262824 /ydah/lrama/lib/lrama/grammar/rule_builder.rb
1260712 /ydah/lrama/lib/lrama/grammar.rb
1108808 /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb
736432 /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb/compiler.rb
568472 /ydah/lrama/lib/lrama/grammar/symbol.rb
518656 /ydah/lrama/lib/lrama/lexer/grammar_file.rb
469809 /ydah/lrama/lib/lrama/grammar/code.rb
436833 /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb.rb
350480 /ydah/lrama/lib/lrama/grammar/rule.rb
332296 racc/parser.rb
309080 /.rbenv/versions/3.3.0/lib/ruby/3.3.0/forwardable.rb
290320 /ydah/lrama/lib/lrama/grammar/parameterizing_rule/resolver.rb
288312 /.rbenv/versions/3.3.0/lib/ruby/3.3.0/set.rb
254880 /ydah/lrama/lib/lrama/grammar/code/rule_action.rb
192584 parser.y
120344 /ydah/lrama/lib/lrama/state/reduce.rb
112240 /ydah/lrama/lib/lrama/lexer/token.rb
98640 /ydah/lrama/lib/lrama/grammar/printer.rb
92440 /ydah/lrama/lib/lrama/lexer/token/tag.rb
75360 /ydah/lrama/lib/lrama/grammar/code/printer_code.rb
70792 /.rbenv/versions/3.3.0/lib/ruby/3.3.0/optparse.rb
46080 /ydah/lrama/lib/lrama/grammar/binding.rb
22560 internal:prelude
16544 /ydah/lrama/template/bison/_yacc.h
11040 /ydah/lrama/lib/lrama/grammar/parameterizing_rule/rhs.rb
10624 /ydah/lrama/lib/lrama/command.rb
5688 /ydah/lrama/lib/lrama/option_parser.rb
2720 internal:timev
2496 /ydah/lrama/template/bison/yacc.c
720 /ydah/lrama/lib/lrama/grammar/destructor.rb
480 /ydah/lrama/lib/lrama/grammar/code/destructor_code.rb
152 exe/lrama
80 /ydah/lrama/lib/lrama/grammar/code/initial_action_code.rb
80 /ydah/lrama/lib/lrama/options.rb
80 /ydah/lrama/lib/lrama/warning.rb
80 /ydah/lrama/template/bison/yacc.h
40 /ydah/lrama/lib/lrama/grammar/union.rb

allocated memory by location

1336343436 /ydah/lrama/lib/lrama/lexer.rb:145
1135418426 /ydah/lrama/lib/lrama/lexer.rb:153
175637082 /ydah/lrama/lib/lrama/lexer.rb:139
175124358 /ydah/lrama/lib/lrama/lexer.rb:132
53366600 /ydah/lrama/lib/lrama/bitmap.rb:18
53366600 /ydah/lrama/lib/lrama/bitmap.rb:23
51743561 /ydah/lrama/lib/lrama/lexer.rb:151
50637200 /ydah/lrama/lib/lrama/states.rb:206
42488960 /ydah/lrama/lib/lrama/states.rb:387
42095519 /ydah/lrama/lib/lrama/lexer.rb:148
23083920 /ydah/lrama/lib/lrama/states.rb:415
19882444 /ydah/lrama/lib/lrama/lexer.rb:142
11499600 /ydah/lrama/lib/lrama/output.rb:377
9967413 /ydah/lrama/lib/lrama/lexer.rb:96
8788960 /ydah/lrama/lib/lrama/context.rb:267
8342000 /ydah/lrama/lib/lrama/states/item.rb:54
7296680 /ydah/lrama/lib/lrama/bitmap.rb:14
6598418 /ydah/lrama/lib/lrama/lexer.rb:94
6487552 /ydah/lrama/lib/lrama/states.rb:414
5280480 /ydah/lrama/lib/lrama/bitmap.rb:7
3927992 /ydah/lrama/lib/lrama/output.rb:449
3384960 /ydah/lrama/lib/lrama/states/item.rb:30
3367480 /ydah/lrama/lib/lrama/lexer/token/user_code.rb:26
2698015 /ydah/lrama/lib/lrama/lexer.rb:157
2603504 /ydah/lrama/lib/lrama/output.rb:450
2385760 /ydah/lrama/lib/lrama/output.rb:451
2350912 /ydah/lrama/lib/lrama/context.rb:266
2253448 /ydah/lrama/lib/lrama/output.rb:376
2134560 /ydah/lrama/lib/lrama/states.rb:347
2024320 /ydah/lrama/lib/lrama/state.rb:55
1890496 /ydah/lrama/lib/lrama/states.rb:193
1890496 /ydah/lrama/lib/lrama/states.rb:194
1865632 /ydah/lrama/lib/lrama/context.rb:220
1716680 /ydah/lrama/lib/lrama/states/item.rb:42
1584000 /ydah/lrama/lib/lrama/states.rb:368
1584000 /ydah/lrama/lib/lrama/states.rb:370
1584000 /ydah/lrama/lib/lrama/states.rb:392
1584000 /ydah/lrama/lib/lrama/states.rb:396
1583240 /ydah/lrama/lib/lrama/states.rb:398
1583240 /ydah/lrama/lib/lrama/states.rb:399
1394640 /ydah/lrama/lib/lrama/states.rb:292
1280032 /ydah/lrama/lib/lrama/state.rb:52
1271128 /ydah/lrama/lib/lrama/state.rb:82
1252800 /ydah/lrama/lib/lrama/lexer.rb:66
1160800 /ydah/lrama/lib/lrama/digraph.rb:39
1094520 /ydah/lrama/lib/lrama/lexer.rb:152
1078400 /ydah/lrama/lib/lrama/state.rb:20
1078400 /ydah/lrama/lib/lrama/state.rb:38
1067280 /ydah/lrama/lib/lrama/states.rb:349
1067280 /ydah/lrama/lib/lrama/states.rb:352

allocated memory by class

2967047062 String
129871744 Array
116655560 Integer
59981872 Hash
20771722 Regexp
11795880 Lrama::States::Item
1261320 Range
1012160 Lrama::State::Shift
446160 MatchData
373280 Enumerator
250560 Lrama::Lexer::Location
215728 Lrama::State
186560 Lrama::Grammar::Reference
147640 Lrama::Lexer::Token::Ident
128744 Lrama::Grammar::Rule
125920 Lrama::Grammar::RuleBuilder
114208 Lrama::State::Reduce
106304 StringScanner
80160 Lrama::State::ResolvedConflict
71840 Lrama::Grammar::Symbol
48992 Lrama::Lexer::Token::UserCode
29080 Set
23680 Lrama::Grammar::Code::RuleAction
18120 File
10960 Lrama::Grammar::Code::PrinterCode
8840 Lrama::Lexer::Token::Char
8584 Lrama::Lexer::Token::InstantiateRule
8120 Lrama::Grammar::Type
4280 Lrama::Lexer::Token::Tag
3400 Lrama::Grammar::Binding
2720 Time
1920 Lrama::Grammar::Precedence
1520 Proc
1408 OptionParser::OptionMap
1040 Lrama::Grammar::ParameterizingRule::Rule
992 Lrama::Grammar
800 Lrama::Grammar::ParameterizingRule::Rhs
640 OptionParser::Switch::NoArgument
576 Racc::CparseParams
480 OptionParser::Switch::RequiredArgument
368 Lrama::Parser
264 Binding
240 ERB
240 ERB::Compiler
240 ERB::Compiler::ExplicitScanner
240 OptionParser::Switch::OptionalArgument
208 Lrama::Context
200 Lrama::Grammar::Printer
160 Lrama::Digraph
160 Lrama::Grammar::Auxiliary

allocated objects by gem

6985417 lrama/lib
11206 other
5991 erb
4253 forwardable
1454 set
930 optparse

allocated objects by file

2814507 /ydah/lrama/lib/lrama/bitmap.rb
2629522 /ydah/lrama/lib/lrama/states.rb
388725 /ydah/lrama/lib/lrama/lexer.rb
331722 /ydah/lrama/lib/lrama/output.rb
252431 /ydah/lrama/lib/lrama/context.rb
213657 /ydah/lrama/lib/lrama/states/item.rb
146596 /ydah/lrama/lib/lrama/state.rb
96785 /ydah/lrama/lib/lrama/lexer/token/user_code.rb
29026 /ydah/lrama/lib/lrama/digraph.rb
21159 /ydah/lrama/lib/lrama/grammar.rb
21013 /ydah/lrama/lib/lrama/grammar/rule_builder.rb
10335 /ydah/lrama/lib/lrama/grammar/symbol.rb
8235 racc/parser.rb
5558 /ydah/lrama/lib/lrama/grammar/code.rb
5411 /ydah/lrama/lib/lrama/grammar/code/rule_action.rb
4253 /.rbenv/versions/3.3.0/lib/ruby/3.3.0/forwardable.rb
4032 /ydah/lrama/lib/lrama/grammar/rule.rb
3163 /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb/compiler.rb
2828 /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb.rb
2806 /ydah/lrama/lib/lrama/lexer/token.rb
2540 /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb
2408 /ydah/lrama/lib/lrama/state/reduce.rb
2315 parser.y
2311 /ydah/lrama/lib/lrama/lexer/token/tag.rb
1905 /ydah/lrama/lib/lrama/grammar/parameterizing_rule/resolver.rb
1454 /.rbenv/versions/3.3.0/lib/ruby/3.3.0/set.rb
1256 /ydah/lrama/lib/lrama/grammar/code/printer_code.rb
930 /.rbenv/versions/3.3.0/lib/ruby/3.3.0/optparse.rb
822 /ydah/lrama/lib/lrama/grammar/printer.rb
672 /ydah/lrama/lib/lrama/grammar/binding.rb
564 internal:prelude
92 /ydah/lrama/lib/lrama/grammar/parameterizing_rule/rhs.rb
83 /ydah/lrama/lib/lrama/option_parser.rb
50 /ydah/lrama/template/bison/yacc.c
34 internal:timev
18 /ydah/lrama/lib/lrama/command.rb
8 /ydah/lrama/lib/lrama/grammar/code/destructor_code.rb
6 /ydah/lrama/lib/lrama/grammar/destructor.rb
4 /ydah/lrama/lib/lrama/lexer/grammar_file.rb
4 /ydah/lrama/template/bison/_yacc.h
2 /ydah/lrama/lib/lrama/grammar/code/initial_action_code.rb
2 /ydah/lrama/lib/lrama/options.rb
2 /ydah/lrama/lib/lrama/warning.rb
2 /ydah/lrama/template/bison/yacc.h
2 exe/lrama
1 /ydah/lrama/lib/lrama/grammar/union.rb

allocated objects by location

1334165 /ydah/lrama/lib/lrama/bitmap.rb:18
1334165 /ydah/lrama/lib/lrama/bitmap.rb:23
1062224 /ydah/lrama/lib/lrama/states.rb:387
577098 /ydah/lrama/lib/lrama/states.rb:415
506372 /ydah/lrama/lib/lrama/states.rb:206
219724 /ydah/lrama/lib/lrama/context.rb:267
170656 /ydah/lrama/lib/lrama/lexer.rb:142
133912 /ydah/lrama/lib/lrama/output.rb:377
132012 /ydah/lrama/lib/lrama/bitmap.rb:7
84624 /ydah/lrama/lib/lrama/states/item.rb:30
84187 /ydah/lrama/lib/lrama/lexer/token/user_code.rb:26
83420 /ydah/lrama/lib/lrama/states/item.rb:54
57888 /ydah/lrama/lib/lrama/output.rb:450
57010 /ydah/lrama/lib/lrama/output.rb:451
53364 /ydah/lrama/lib/lrama/states.rb:347
50608 /ydah/lrama/lib/lrama/state.rb:55
49700 /ydah/lrama/lib/lrama/lexer.rb:94
43367 /ydah/lrama/lib/lrama/output.rb:376
42917 /ydah/lrama/lib/lrama/states/item.rb:42
39600 /ydah/lrama/lib/lrama/states.rb:368
39600 /ydah/lrama/lib/lrama/states.rb:370
39600 /ydah/lrama/lib/lrama/states.rb:392
39600 /ydah/lrama/lib/lrama/states.rb:396
39581 /ydah/lrama/lib/lrama/states.rb:398
39581 /ydah/lrama/lib/lrama/states.rb:399
29020 /ydah/lrama/lib/lrama/digraph.rb:39
28266 /ydah/lrama/lib/lrama/lexer.rb:145
27198 /ydah/lrama/lib/lrama/output.rb:449
26682 /ydah/lrama/lib/lrama/states.rb:349
26682 /ydah/lrama/lib/lrama/states.rb:352
26652 /ydah/lrama/lib/lrama/state.rb:52
26652 /ydah/lrama/lib/lrama/state.rb:82
26082 /ydah/lrama/lib/lrama/lexer.rb:153
25491 /ydah/lrama/lib/lrama/lexer.rb:96
25304 /ydah/lrama/lib/lrama/state.rb:46
23957 /ydah/lrama/lib/lrama/states.rb:181
22106 /ydah/lrama/lib/lrama/states.rb:280
14165 /ydah/lrama/lib/lrama/bitmap.rb:14
14133 /ydah/lrama/lib/lrama/lexer.rb:144
13883 /ydah/lrama/lib/lrama/states.rb:414
13041 /ydah/lrama/lib/lrama/lexer.rb:152
11053 /ydah/lrama/lib/lrama/context.rb:299
11053 /ydah/lrama/lib/lrama/states.rb:292
11053 /ydah/lrama/lib/lrama/states.rb:296
11053 /ydah/lrama/lib/lrama/states.rb:320
11053 /ydah/lrama/lib/lrama/states.rb:378
9396 /ydah/lrama/lib/lrama/lexer.rb:66
8512 /ydah/lrama/lib/lrama/lexer.rb:111
8235 racc/parser.rb:272
7874 /ydah/lrama/lib/lrama/states.rb:351

allocated objects by class

2916389 Integer
2626276 Array
731242 String
324244 Hash
294897 Lrama::States::Item
36538 Regexp
31533 Range
25304 Lrama::State::Shift
3330 MatchData
3132 Lrama::Lexer::Location
2357 Lrama::Lexer::Token::Ident
2333 Enumerator
2332 Lrama::Grammar::Reference
1348 Lrama::State
1204 Lrama::State::Reduce
1002 Lrama::State::ResolvedConflict
788 Lrama::Grammar::Rule
787 Lrama::Grammar::RuleBuilder
727 Set
616 Lrama::Lexer::Token::UserCode
604 StringScanner
592 Lrama::Grammar::Code::RuleAction
449 Lrama::Grammar::Symbol
274 Lrama::Grammar::Code::PrinterCode
221 Lrama::Lexer::Token::Char
203 Lrama::Grammar::Type
107 Lrama::Lexer::Token::InstantiateRule
107 Lrama::Lexer::Token::Tag
85 Lrama::Grammar::Binding
48 Lrama::Grammar::Precedence
34 Time
20 Lrama::Grammar::ParameterizingRule::Rhs
19 Proc
13 Lrama::Grammar::ParameterizingRule::Rule
8 OptionParser::Switch::NoArgument
7 File
6 OptionParser::Switch::RequiredArgument
5 Lrama::Grammar::Printer
4 Lrama::Grammar::Code::NoReferenceCode
4 Lrama::Grammar::Counter
4 OptionParser::OptionMap
3 Binding
3 ERB
3 ERB::Compiler
3 ERB::Compiler::Buffer
3 ERB::Compiler::ExplicitScanner
3 OptionParser::Switch::OptionalArgument
2 Lrama::Digraph
2 Lrama::Grammar
2 Lrama::Grammar::Auxiliary

retained memory by gem

   256  erb
   256  lrama/lib
    80  other

retained memory by file

   256  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb/compiler.rb
   256  /ydah/lrama/lib/lrama/states.rb
    80  racc/parser.rb

retained memory by location

   256  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb/compiler.rb:394
   256  /ydah/lrama/lib/lrama/states.rb:207
    80  racc/parser.rb:272

retained memory by class

   512  Hash
    80  String

retained objects by gem

     2  other
     1  erb
     1  lrama/lib

retained objects by file

     2  racc/parser.rb
     1  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb/compiler.rb
     1  /ydah/lrama/lib/lrama/states.rb

retained objects by location

     2  racc/parser.rb:272
     1  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb/compiler.rb:394
     1  /ydah/lrama/lib/lrama/states.rb:207

retained objects by class

     2  Hash
     2  String

Allocated String Report

 74346  "\\Z"
 74345  /ydah/lrama/lib/lrama/lexer.rb:142
     1  parser.y:510

 58257  " "
 54747  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:26
  2054  /ydah/lrama/lib/lrama/lexer.rb:78
   592  /ydah/lrama/lib/lrama/output.rb:243
   536  /ydah/lrama/lib/lrama/grammar/rule.rb:29
   288  /ydah/lrama/lib/lrama/lexer.rb:173
    30  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb/compiler.rb:378
     2  /ydah/lrama/lib/lrama/lexer.rb:152
     2  /ydah/lrama/lib/lrama/lexer.rb:153
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:198
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:223
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:224
     1  /ydah/lrama/lib/lrama/option_parser.rb:69
     1  /ydah/lrama/lib/lrama/option_parser.rb:77
     1  /ydah/lrama/lib/lrama/output.rb:433

 41830  ","
 39369  /ydah/lrama/lib/lrama/output.rb:377
  1761  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:26
   445  /ydah/lrama/lib/lrama/output.rb:81
   131  /ydah/lrama/lib/lrama/output.rb:67
    33  /ydah/lrama/lib/lrama/lexer.rb:152
    33  /ydah/lrama/lib/lrama/lexer.rb:153
    26  /ydah/lrama/lib/lrama/lexer.rb:95
    16  /ydah/lrama/lib/lrama/lexer.rb:173
    13  /ydah/lrama/lib/lrama/lexer.rb:94
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:198
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:223
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:224

 39380  "%6d%s"
 39380  /ydah/lrama/lib/lrama/output.rb:377

 38456  "\n"
 14670  /ydah/lrama/lib/lrama/lexer.rb:145
 14133  /ydah/lrama/lib/lrama/lexer.rb:144
  2472  /ydah/lrama/lib/lrama/output.rb:449
  2252  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:26
  2146  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb.rb:429
  2056  /ydah/lrama/lib/lrama/lexer.rb:76
   527  /ydah/lrama/lib/lrama/lexer.rb:149
    85  /ydah/lrama/lib/lrama/lexer.rb:168
    63  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb/compiler.rb:262
    21  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb/compiler.rb:306
    11  /ydah/lrama/lib/lrama/output.rb:378
     6  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb/compiler.rb:255
     6  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb/compiler.rb:367
     6  /ydah/lrama/lib/lrama/lexer.rb:83
     2  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb/compiler.rb:254

 37244  ""
 28443  /ydah/lrama/lib/lrama/lexer.rb:142
  5251  /ydah/lrama/lib/lrama/lexer.rb:94
  2811  /ydah/lrama/lib/lrama/lexer.rb:96
   598  /ydah/lrama/lib/lrama/lexer.rb:126
    28  /ydah/lrama/lib/lrama/lexer.rb:154
    27  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb/compiler.rb:388
    16  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb/compiler.rb:255
    14  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb/compiler.rb:306
    14  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb/compiler.rb:367
    11  /ydah/lrama/lib/lrama/output.rb:377
     6  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb/compiler.rb:354
     3  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb.rb:429
     3  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb/compiler.rb:322
     2  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb/compiler.rb:257
     2  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/erb/compiler.rb:290
     2  /ydah/lrama/lib/lrama/output.rb:399
     2  parser.y:29
     1  /ydah/lrama/lib/lrama/option_parser.rb:54
     1  /ydah/lrama/lib/lrama/option_parser.rb:57
     1  /ydah/lrama/lib/lrama/option_parser.rb:62
     1  /ydah/lrama/lib/lrama/option_parser.rb:67
     1  /ydah/lrama/lib/lrama/option_parser.rb:75
     1  /ydah/lrama/lib/lrama/option_parser.rb:80
     1  /ydah/lrama/lib/lrama/option_parser.rb:83
     1  /ydah/lrama/lib/lrama/output.rb:30
     1  /ydah/lrama/lib/lrama/output.rb:432
     1  /ydah/lrama/lib/lrama/output.rb:67
     1  /ydah/lrama/lib/lrama/output.rb:81

 31507  "%{|%}|%%|{|}|\\[|\\]|\\(|\\)|\\,|:|\\||;"
 31507  /ydah/lrama/lib/lrama/lexer.rb:94

 27188  "[@ofile@]"
 27188  /ydah/lrama/lib/lrama/output.rb:451

 27188  "[@oline@]"
 27188  /ydah/lrama/lib/lrama/output.rb:450

 26944  "\"parse.tmp.c\""
 26944  /ydah/lrama/lib/lrama/output.rb:451

 26111  "}"
 19312  /ydah/lrama/lib/lrama/lexer.rb:142
  2177  /ydah/lrama/lib/lrama/lexer.rb:134
  1581  /ydah/lrama/lib/lrama/lexer.rb:139
  1192  /ydah/lrama/lib/lrama/lexer.rb:95
   596  /ydah/lrama/lib/lrama/lexer.rb:135
   596  /ydah/lrama/lib/lrama/lexer.rb:94
   574  parser.y:469
    58  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:26
    11  parser.y:303
     5  parser.y:111
     2  parser.y:362
     2  parser.y:79
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:198
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:223
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:224
     1  parser.y:64
     1  parser.y:95

 20118  "%}"
 20114  /ydah/lrama/lib/lrama/lexer.rb:142
     2  /ydah/lrama/lib/lrama/lexer.rb:95
     1  /ydah/lrama/lib/lrama/lexer.rb:94
     1  parser.y:16

 16867  "%union|%token|%type|%left|%right|%nonassoc|%expect|%define|%require|%printer|%destructor|%lex-param|%parse-param|%initial-action|%precedence|%prec|%error-token|%before-reduce|%after-reduce|%after-shif"
 16867  /ydah/lrama/lib/lrama/lexer.rb:96

  9588  "|"
  5755  /ydah/lrama/lib/lrama/lexer.rb:94
  2811  /ydah/lrama/lib/lrama/lexer.rb:96
  1008  /ydah/lrama/lib/lrama/lexer.rb:95
    11  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:26
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:198
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:223
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:224

  8816  "     0,"
  8816  /ydah/lrama/lib/lrama/output.rb:377

  8414  "    -1,"
  8414  /ydah/lrama/lib/lrama/output.rb:377

  8194  "$"
  1679  /ydah/lrama/lib/lrama/grammar/code/rule_action.rb:41
  1258  /ydah/lrama/lib/lrama/grammar/rule_builder.rb:223
  1092  /ydah/lrama/lib/lrama/grammar/symbol.rb:93
  1049  /ydah/lrama/lib/lrama/grammar/rule_builder.rb:224
   765  /ydah/lrama/lib/lrama/grammar/symbol.rb:70
   659  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:40
   639  /ydah/lrama/lib/lrama/grammar/code/rule_action.rb:46
   628  /ydah/lrama/lib/lrama/grammar/code/printer_code.rb:20
   404  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:54
    11  /ydah/lrama/lib/lrama/lexer.rb:173
     4  /ydah/lrama/lib/lrama/grammar/code/destructor_code.rb:20
     3  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:26
     2  racc/parser.rb:272
     1  /ydah/lrama/lib/lrama/grammar/code/initial_action_code.rb:17

  5010  "{"
  1581  /ydah/lrama/lib/lrama/lexer.rb:131
  1581  /ydah/lrama/lib/lrama/lexer.rb:132
  1192  /ydah/lrama/lib/lrama/lexer.rb:95
   596  /ydah/lrama/lib/lrama/lexer.rb:94
    57  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:26
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:198
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:223
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:224

  3963  "  "
  3943  /ydah/lrama/lib/lrama/output.rb:377
    20  /ydah/lrama/lib/lrama/lexer.rb:78

  3150  "_"
  1795  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:26
  1168  /ydah/lrama/lib/lrama/grammar/symbol.rb:78
    99  /ydah/lrama/lib/lrama/lexer.rb:173
    85  /ydah/lrama/lib/lrama/grammar/rule_builder.rb:188
     3  /ydah/lrama/lib/lrama/output.rb:387

  2117  ";"
  1116  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:26
   488  /ydah/lrama/lib/lrama/lexer.rb:95
   244  /ydah/lrama/lib/lrama/lexer.rb:94
   133  /ydah/lrama/lib/lrama/lexer.rb:152
   133  /ydah/lrama/lib/lrama/lexer.rb:153
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:198
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:223
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:224

  2102  "                    "
   536  /ydah/lrama/lib/lrama/lexer.rb:152
   536  /ydah/lrama/lib/lrama/lexer.rb:153
   518  /ydah/lrama/lib/lrama/lexer.rb:78
   512  /ydah/lrama/lib/lrama/output.rb:243

  1759  "@"
  1038  /ydah/lrama/lib/lrama/grammar/symbol.rb:93
   711  /ydah/lrama/lib/lrama/grammar/symbol.rb:70
    10  /ydah/lrama/lib/lrama/grammar/rule_builder.rb:161

  1756  "#line [@oline@] [@ofile@]\n"
  1756  /ydah/lrama/lib/lrama/output.rb:450

  1721  "e"
  1539  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:26
   181  /ydah/lrama/lib/lrama/lexer.rb:173
     1  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/optparse.rb:1497

  1467  "node"
  1467  /ydah/lrama/lib/lrama/lexer/token/tag.rb:7

  1341  "p"
  1200  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:26
    96  /ydah/lrama/lib/lrama/lexer.rb:173
    45  /ydah/lrama/lib/lrama/output.rb:301

  1299  ")"
  1053  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:26
   144  /ydah/lrama/lib/lrama/lexer.rb:95
    72  /ydah/lrama/lib/lrama/lexer.rb:94
    15  /ydah/lrama/lib/lrama/lexer.rb:173
     6  /ydah/lrama/lib/lrama/lexer.rb:152
     6  /ydah/lrama/lib/lrama/lexer.rb:153
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:198
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:223
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:224

  1288  "("
  1054  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:26
   144  /ydah/lrama/lib/lrama/lexer.rb:95
    72  /ydah/lrama/lib/lrama/lexer.rb:94
    15  /ydah/lrama/lib/lrama/lexer.rb:173
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:198
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:223
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:224

  1286  "n"
  1139  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:26
   147  /ydah/lrama/lib/lrama/lexer.rb:173

  1186  "a"
  1078  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:26
   108  /ydah/lrama/lib/lrama/lexer.rb:173

  1168  "YYSYMBOL_"
  1168  /ydah/lrama/lib/lrama/grammar/symbol.rb:78

  1085  ":"
   484  /ydah/lrama/lib/lrama/lexer.rb:95
   242  /ydah/lrama/lib/lrama/lexer.rb:94
   126  /ydah/lrama/lib/lrama/lexer.rb:152
   126  /ydah/lrama/lib/lrama/lexer.rb:153
    52  /ydah/lrama/lib/lrama/lexer.rb:173
    48  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:26
     4  /ydah/lrama/lib/lrama/lexer.rb:113
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:198
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:223
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:224

  1039  "t"
   938  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:26
    99  /ydah/lrama/lib/lrama/lexer.rb:173
     1  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/optparse.rb:1497
     1  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/optparse.rb:866

   996  "r"
   846  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:26
   148  /ydah/lrama/lib/lrama/lexer.rb:173
     1  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/optparse.rb:1497
     1  /ydah/lrama/lib/lrama/option_parser.rb:26

   925  "1"
   696  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:43
   158  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:56
    56  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:26
    14  /ydah/lrama/lib/lrama/lexer.rb:173
     1  /ydah/lrama/lib/lrama/grammar/rule_builder.rb:163

   896  "s"
   822  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:26
    74  /ydah/lrama/lib/lrama/lexer.rb:173

   885  "o"
   771  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:26
   111  /ydah/lrama/lib/lrama/lexer.rb:173
     1  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/optparse.rb:1497
     1  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/optparse.rb:1663
     1  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/optparse.rb:866

   852  "    "
   424  /ydah/lrama/lib/lrama/lexer.rb:152
   424  /ydah/lrama/lib/lrama/lexer.rb:153
     3  /ydah/lrama/lib/lrama/lexer.rb:78
     1  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/optparse.rb:1143

   850  "i"
   762  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:26
    88  /ydah/lrama/lib/lrama/lexer.rb:173

   849  "}\n"
   849  /ydah/lrama/lib/lrama/output.rb:449

   829  "="
   816  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:26
    10  /ydah/lrama/lib/lrama/lexer.rb:173
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:198
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:223
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:224

   787  " -1113,"
   787  /ydah/lrama/lib/lrama/output.rb:377

   778  "                "
   691  /ydah/lrama/lib/lrama/lexer.rb:78
    43  /ydah/lrama/lib/lrama/lexer.rb:152
    43  /ydah/lrama/lib/lrama/lexer.rb:153
     1  /ydah/lrama/lib/lrama/output.rb:243

   768  "l"
   717  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:26
    51  /ydah/lrama/lib/lrama/lexer.rb:173

   758  "    }\n"
   758  /ydah/lrama/lib/lrama/output.rb:449

   696  "d"
   646  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:26
    48  /ydah/lrama/lib/lrama/lexer.rb:173
     1  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/optparse.rb:1497
     1  /.rbenv/versions/3.3.0/lib/ruby/3.3.0/optparse.rb:866

   685  "\\\""
   685  /ydah/lrama/lib/lrama/output.rb:436

   673  "        "
   305  /ydah/lrama/lib/lrama/lexer.rb:152
   305  /ydah/lrama/lib/lrama/lexer.rb:153
    62  /ydah/lrama/lib/lrama/lexer.rb:78
     1  /ydah/lrama/lib/lrama/output.rb:243

   662  "&"
   659  /ydah/lrama/lib/lrama/lexer/token/user_code.rb:26
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:198
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:223
     1  /ydah/lrama/lib/lrama/grammar/symbols/resolver.rb:224

Retained String Report

     1  "@tstack"
     1  racc/parser.rb:272

     1  "@vstack"
     1  racc/parser.rb:272

</details>

@ydah
Copy link
Collaborator Author

ydah commented Jun 5, 2024

Execution speed

Measured using stackprof.

  1. Create parse.tmp.y in ruby/ruby
$ ruby tool/id2token.rb parse.y > parse.tmp.y
$ cp parse.tmp.y dir/lrama/tmp
  1. Enable Profiler
diff --git a/exe/lrama b/exe/lrama
index ba5fb06..2497178 100755
--- a/exe/lrama
+++ b/exe/lrama
@@ -3,4 +3,6 @@
 $LOAD_PATH << File.join(__dir__, "../lib")
 require "lrama"

-Lrama::Command.new.run(ARGV.dup)
+Lrama::Report::Profile.report_profile do
+  Lrama::Command.new.run(ARGV.dup)
+end

Before

❯ exe/lrama --trace=time -o parse.tmp.c --header=parse.tmp.h tmp/parse.tmp.y
parse    0.43754 s
parse    0.00254 s
compute_lr0_states    0.23107 s
compute_direct_read_sets    0.03482 s
compute_reads_relation    0.00532 s
compute_read_sets    0.01844 s
compute_includes_relation    0.09763 s
compute_lookback_relation    0.17840 s
compute_follow_sets    0.05260 s
compute_look_ahead_sets    0.52621 s
compute_conflicts    0.00375 s
compute_default_reduction    0.00161 s
compute_yydefact    0.03800 s
compute_yydefgoto    0.00447 s
sort_actions    0.00347 s
compute_packed_table    0.26376 s
render    0.05502 s

After

❯ exe/lrama --trace=time -o parse.tmp.c --header=parse.tmp.h tmp/parse.tmp.y
parse    0.41065 s
parse    0.00255 s
compute_lr0_states    0.23642 s
compute_direct_read_sets    0.03494 s
compute_reads_relation    0.00524 s
compute_read_sets    0.01842 s
compute_includes_relation    0.09893 s
compute_lookback_relation    0.18064 s
compute_follow_sets    0.05006 s
compute_look_ahead_sets    0.52725 s
compute_conflicts    0.00374 s
compute_default_reduction    0.00158 s
compute_yydefact    0.03966 s
compute_yydefgoto    0.00471 s
sort_actions    0.00342 s
compute_packed_table    0.25779 s
render    0.06717 s

@ydah ydah force-pushed the fixes-string-issue2 branch from 36347e8 to 72781c8 Compare June 5, 2024 14:41
@ydah
Copy link
Collaborator Author

ydah commented Jun 5, 2024

I think this change is something that should be considered.
I don't think the behavior will change, but I am not sure if it will not impact execution speed or memory usage.

Thank you! I measured each before and after. I verified and there seems to be no significant deterioration.
@junk0612 WDYT?

@junk0612
Copy link
Collaborator

junk0612 commented Jun 5, 2024

I see. Both memory usage and execution time have increased. However, it seems that the Lexer/Parser still dominates both memory usage and execution time, and Output is not the bottleneck. This level of increase appears to be acceptable. Thank you for the measurements.

@ydah ydah merged commit 3fafbc2 into ruby:master Jun 5, 2024
16 checks passed
@ydah ydah deleted the fixes-string-issue2 branch June 5, 2024 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants