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

RubyModule.searchMethodInner results in exponential runtime expansion #2217

cheald opened this issue Nov 18, 2014 · 1 comment


Copy link

cheald commented Nov 18, 2014

searchMethodInner iterates up the inheritance hierarchy and calls searchMethodCommon on each module in the chain, but searchMethodCommon also calls searchMethodInner on its superClass! This results in ridiculous exponential expansion of work when a method can't be found. To reproduce the issue:

cls =
20.times { cls = }
cls.non_existing_method rescue nil

Calling non_existing_method takes ~8 sec at a depth of 20, ~14 sec at 21, ~26 sec at 22, etc.

I'm not quite sure what the right fix is, since this is in prepend territory, but it's a definite problem right now.

Copy link

tduehr commented Nov 19, 2014

Comments at #2218 from me. This patch should fix it. The logic causing the recursion is from the other prepend implementation.

@cheald cheald closed this as completed Nov 19, 2014
@enebo enebo added this to the JRuby milestone Dec 8, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

No branches or pull requests

4 participants