Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function that takes ~1 second to execute is the PayloadSet's
recalculate
method. There's a comment on the code that this approach may not work as we expect:metasploit-framework/lib/msf/core/payload_set.rb
Lines 7 to 17 in 4c06146
We might need a different approach to the above, but it's worth double checking.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Poking further at this; I'm concerned that this approach breaks the law of demeter, and may not work well with some of the assumptions that are already in place within framework. In particular it seems like module set already has some nil handling in place:
metasploit-framework/lib/msf/core/module_set.rb
Lines 42 to 50 in 4c06146
Which is actually why the slow
recalculate
method gets called in the first place. It might be worth doing a bit of git fu to learn why that logic was added in the first place, to make sure this approach doesn't break existing logic etc.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cross referencing some discussion on bootup/missing command performance - #7292 (comment)