diff options
author | Kevin Newton <[email protected]> | 2024-05-13 11:26:39 -0400 |
---|---|---|
committer | git <[email protected]> | 2024-05-13 15:34:47 +0000 |
commit | e6340258f88064cabba5150cfef1f8898f6aa9d8 () | |
tree | c11f577729a187919a1f5922d5111918863650db /lib/prism/parse_result/comments.rb | |
parent | 02c8e6583b33c62b4050420234167a467f32fefa (diff) |
[ruby/prism] Autoload newlines and comment visitors
Having the @newline instance variable in every node adds up, and since it is so rarely used, we only want to add it when necessary. Moving this into an autoloaded file and moving the instance variable out of the default initializers reduces allocated memory because the nodes are now smaller and some fit into the compact list. On my machine, I'm seeing about an 8% drop. https://.com/ruby/prism/commit/eea92c07d2
-rw-r--r-- | lib/prism/parse_result/comments.rb | 7 |
1 files changed, 0 insertions, 7 deletions
@@ -183,12 +183,5 @@ module Prism [preceding, NodeTarget.new(node), following] end end - - private_constant :Comments - - # Attach the list of comments to their respective locations in the tree. - def attach_comments! - Comments.new(self).attach! # steep:ignore - end end end |