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

Remove generic mutation to self #1210

Merged
merged 1 commit into from
Jan 16, 2021
Merged

Remove generic mutation to self #1210

merged 1 commit into from
Jan 16, 2021

Conversation

dgollahon
Copy link
Collaborator

@dgollahon dgollahon commented Jan 16, 2021

  • This rarely yields an alive mutation and, when it does, it can sometimes be frustrating to avoid or work around. It is also probably a bit confusing to newcomers. Removing this should also make mutant runs shorter since it is a frequently generated mutation.

@dgollahon dgollahon force-pushed the remove-mutation-to-self branch 2 times, most recently from 4eaee10 to 9113c33 Compare January 16, 2021 05:17
Comment on lines +241 to +245
def emit_explicit_self
return if UNARY_METHOD_OPERATORS.include?(selector)

emit_receiver(N_SELF) unless n_nil?(receiver)
end
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mbj I added this and this to keep the change in behavior a bit more narrow since it may be useful to change foo.bar.baz to self.baz.

That said, we could also just emit implicit self in more cases and not generate this most of the time if we wanted. There are only a few cases where the explicit self is necessary or preferred self.foo = 1, etc.

If we emitted the implicit self directly instead of explicit, that would probably be nice for cases where mutant emits self.baz and you have to run it again to see that actually you could have just done baz. I have a WIP commit that does something like this that I can show you (I may just push it to this branch).

@dgollahon dgollahon force-pushed the remove-mutation-to-self branch 4 times, most recently from 91e2a58 to e0fb2b0 Compare January 16, 2021 06:08
@mbj mbj marked this pull request as ready for review January 16, 2021 17:02
@mbj mbj self-requested a review January 16, 2021 17:02
@mbj
Copy link
Owner

mbj commented Jan 16, 2021

@dgollahon feel free to merge past rebase.

@dgollahon dgollahon force-pushed the remove-mutation-to-self branch 2 times, most recently from b3330c7 to 7da06f6 Compare January 16, 2021 20:00
@dgollahon
Copy link
Collaborator Author

dgollahon commented Jan 16, 2021

Fun fact: on auom, this reduces the total number of mutations from 1000 to 805, so i guess this should make most mutant runs (after boot time, of course, so not total wall time) approximately 20% faster.

- This rarely yields an alive mutation and, when it does, it can sometimes be frustrating to avoid or work around. It is also probably a bit confusing to newcomers. Removing this should also make mutant runs shorter since it is a frequently generated mutation.
@dgollahon dgollahon merged commit 2893344 into master Jan 16, 2021
@dgollahon dgollahon deleted the remove-mutation-to-self branch January 16, 2021 20:20
@mbj
Copy link
Owner

mbj commented Jan 16, 2021

@dgollahon In astronomy there is the concept of a Standard Candle. An event of known magnitude that can serve as a reference in an otherwise very relative observation space with too many variables.

As the standard candle event does not "change" lots of astrophysics measurements are first made possible. Unlike corpus tests where both the implementation and the content of the corpus can change, currently auom is our standard candle. Its code is frozen in time (small library and "done"), hence its "magnitude (of semantics)" is frozen.

Also the test suite is fully covering mutant both for rspec and minitest. Its a very good "non moving" optimization target.

@dgollahon
Copy link
Collaborator Author

Yeah, I think it is a very cool reference point. The Standard Candle comparison is a good one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants