@@ -15,7 +15,6 @@ module Prism
1515 when "encoding" then encoding ( argv )
1616 when "lex" then lex ( argv )
1717 when "locals" then locals ( argv )
18- when "memsize" then memsize
1918 when "parse" then parse ( argv )
2019 when "parser" then parser ( argv )
2120 when "ripper" then ripper ( argv )
@@ -30,7 +29,6 @@ module Prism
3029 bin/prism encoding [encoding]
3130 bin/prism lex [source]
3231 bin/prism locals [source]
33- bin/prism memsize
3432 bin/prism parse [source]
3533 bin/prism parser [source]
3634 bin/prism ripper [source]
@@ -246,35 +244,6 @@ module Prism
246244 end
247245 end
248246
249- # bin/prism memsize
250- def memsize
251- require "yaml"
252-
253- filepath = File . expand_path ( "../config.yml" , __dir__ )
254- results =
255- YAML . load_file ( filepath ) . fetch ( "nodes" ) . map do |node |
256- [
257- node [ "name" ] ,
258- node . fetch ( "fields" , [ ] ) . sum do |field |
259- case field [ "type" ]
260- when "uint8" then 1
261- when "uint32" , "constant" , "constant?" then 4
262- when "node" , "node?" , "double" then 8
263- when "location" , "location?" then 16
264- when "node[]" , "string" , "token" , "token?" , "constant[]" then 24
265- when "integer" then 32
266- when "flags" then 0
267- else raise "Unknown type: #{ field [ "type" ] } "
268- end
269- end
270- ]
271- end
272-
273- results . sort_by ( &:last ) . reverse_each do |name , size |
274- puts "#{ name } : #{ size } "
275- end
276- end
277-
278247 # bin/prism parser [source]
279248 def parser ( argv )
280249 require "parser/ruby34"
0 commit comments