Permalink
Browse files

Avoid overriding Sexp#initialize

and get a free performance boost, yay!
  • Loading branch information...
1 parent a651424 commit 47f91cd7597635ba2bd30c95bc58e9de9437717d Justin Collins committed Apr 17, 2012
Showing with 1 addition and 8 deletions.
  1. +1 −8 lib/ruby_parser/bm_sexp.rb
@@ -20,7 +20,6 @@ def to_sym
alias :node_type :sexp_type
alias :values :sexp_body # TODO: retire
- alias :old_init :initialize
alias :old_push :<<
alias :old_line :line
alias :old_line_set :line=
@@ -30,19 +29,13 @@ def to_sym
alias :old_fara :find_and_replace_all
alias :old_find_node :find_node
- def initialize *args
- old_init(*args)
- @original_line = nil
- @my_hash_value = nil
- end
-
def original_line line = nil
if line
@my_hash_value = nil
@original_line = line
self
else
- @original_line
+ @original_line ||= nil
end
end

0 comments on commit 47f91cd

Please sign in to comment.