Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Excessive method_missing calls #87

nirvdrum opened this Issue · 2 comments

2 participants


Psych::Visitors::ToRuby#visit_Psych_Nodes_Sequence can result in excessive method_missing calls. The issue is o.tag can be nil and nil being compared to a RegExp apparently results in a method_missing call, as is the situation with the second when clause in that method. Adding an explicit when nil earlier in the sequence reduced the number of method_missing calls for one test file I have (using a lot of VCR) from 905 calls to 0. These 905 calls accounted for 12.6% of the total test time and was clearly a hot spot.

I can provide a patch, but I wasn't sure how you wanted to fix it. Right now I've just duplicated the when nil body with the else body. I can extract that to a private method and call from both cases in order to avoid duplicated code. But if you want to restructure the whole thing, just let me know.


Ya, extracting the private method sounds good. Please do it! :-)


Closed by merging #88.

@nirvdrum nirvdrum closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.