-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Emit a performance warning when a class reached max variations #7708
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
Conversation
a47ba68
to
661dd65
Compare
/** Warning is for experimental features. */ | ||
RB_WARN_CATEGORY_EXPERIMENTAL, | ||
|
||
RB_WARN_CATEGORY_ALL_BITS = ( |
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.
Since this file is a public header, we may have to keep the name including the new bit.
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.
Ah, I didn't notice that. Thanks, I'll restore the old name.
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.
Sorry, I meant to keep the old name and add the new name for the bits enabled by -w
.
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.
Oh. I'll make another PR.
[Feature #19538] This new `peformance` warning category is disabled by default. It needs to be specifically enabled via `-W:performance` or `Warning[:performance] = true`
661dd65
to
8f06c80
Compare
Could you add an entry in NEWS for this? |
So I wanted to do this, but none of the existing section made sense. Any idea? |
#7715 seems fine, could also be under command-line changes or so (I guess older NEWS files must have a way to document those) & Warning. |
|
||
def test_max_shape_variation_with_performance_warnings | ||
assert_in_out_err([], <<-INPUT, %w(), /Maximum shapes variations \(8\) reached by Foo, instance variables accesses will be slower\.$/) | ||
$VERBOSE = true |
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.
Does it also work with $VERBOSE = false
? See #7715 (comment)
If only with $VERBOSE = true
, it seems too complicated to enable performance warnings (need to enable two things, very easy to mess up)
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.
I believe it needs both yes.
[Feature #19538]
This new
peformance
warning category is disabled by default. It needs to be specifically enabled via-W:performance
orWarning[:performance] = true
cc @nobu @tenderlove