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

Fix repo location of rubyspec #508

Merged
merged 2 commits into from
Dec 31, 2015
Merged

Fix repo location of rubyspec #508

merged 2 commits into from
Dec 31, 2015

Conversation

mbj
Copy link
Owner

@mbj mbj commented Dec 19, 2015

No description provided.

* Fix bug exposed by new rubyspec location
* Fix excludes on corpus to actually *do stuff*.
@mbj mbj force-pushed the fix/rubyspec-location branch 3 times, most recently from d298e92 to 7b5a209 Compare December 20, 2015 04:06
@mbj
Copy link
Owner Author

mbj commented Dec 20, 2015

@dkubb Ready for review.

@mbj mbj force-pushed the fix/rubyspec-location branch 2 times, most recently from bcfd04a to 8315a4d Compare December 20, 2015 23:35
# @return [Array<Pathname>]
def effective_ruby_paths
paths = Pathname
.glob(repo_path.join('**/*.rb'))
Copy link
Contributor

Choose a reason for hiding this comment

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

Think this glob string could be hoisted up into a constant?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Yes. Just like the other ones.

@backus
Copy link
Contributor

backus commented Dec 21, 2015

@mbj I finished a pass over this PR

@@ -1,14 +1,14 @@
---
- name: rubyspec
namespace: Rubyspec
repo_uri: 'https://github.com/rubyspec/rubyspec.git'
repo_uri: 'https://github.com/ruby/rubyspec.git'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Has development on the rubyspec/rubyspec repo stopped while the ruby/rubyspec one continued?

Copy link
Owner Author

Choose a reason for hiding this comment

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

The repo disappeared. Yes. And I found ruby/rubyspec to be the successor.

@mbj
Copy link
Owner Author

mbj commented Dec 21, 2015

@dkubb Ready for the next pass.

paths = Pathname
.glob(repo_path.join(RUBY_FILE_PATTERN))
.sort_by(&:size)
.reverse
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this was in the previous code but I'm curious, why do you sort and reverse here?

Copy link
Owner Author

Choose a reason for hiding this comment

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

In the following explanation I'll refer to the files in the corpus as item.

On large parallel, blocking (as in all parallel computations have to finish before we can move on) computations we ideally want to have the work most evenly distributed between the concurrent threads and they should all terminate the same moment.

So in the worst case one thread out of N is just, before all others finish their last item starting to process the item with the longest computation time. Adding significantly to the total runtime of the parallel computation in the most inefficient way.

We can avoid this worst case scenario (and also improve the average case!) via making sure that only small items are left when the queue drains, via starting to produce the heavy items early.

Now as part of processing an item in this specific computation we have the problem that we cannot easily estimate the weight of an item. A big file could also be made out of comments that cause no mutations.

But it turns out that using the file size as a cheap to check property is a good approximation to use this optimization.

You can try this for yourself and remove the optimization noticing that we slice some seconds of the overall runtime with this simple thing.

Copy link
Contributor

Choose a reason for hiding this comment

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

Very interesting. Thanks for explaining

@dkubb
Copy link
Collaborator

dkubb commented Dec 28, 2015

@mbj I will be ready to merge this once https://github.com/mbj/mutant/pull/508/files#r48119998 is done, and the build is green.

@mbj
Copy link
Owner Author

mbj commented Dec 29, 2015

@mbj I will be ready to merge this once https://github.com/mbj/mutant/pull/508/files#r48119998 is done, and the build is green.

I hope I get to it today, all under the "on vacation" indeterminism.

@dkubb
Copy link
Collaborator

dkubb commented Dec 29, 2015

I hope I get to it today, all under the "on vacation" indeterminism.

Of course, no pressure.

@mbj mbj force-pushed the fix/rubyspec-location branch 2 times, most recently from 25f393f to 0bbf264 Compare December 30, 2015 18:42
@mbj
Copy link
Owner Author

mbj commented Dec 30, 2015

@dkubb Ready for the next pass.

@@ -10,10 +10,18 @@ module MutantSpec
#
# rubocop:disable MethodLength
module Corpus
TMP = ROOT.join('tmp').freeze
EXCLUDE_GLOB_FORMAT = '{%s}'.freeze
RUBY_GLOB_PATTERN = '**/*.rb'
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we freeze this?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Yes.

@mbj
Copy link
Owner Author

mbj commented Dec 30, 2015

@dkubb Ready for the next pass.

@backus
Copy link
Contributor

backus commented Dec 30, 2015

You can also remove core/regexp/shared/new.rb from the excludes in the rubyspec integration since that file was deleted in ruby/spec@9614f25

# @return [Array<Pathname>]
def excluded_paths
Pathname.glob(repo_path.join(EXCLUDE_GLOB_FORMAT % exclude.join(',')))
end

# Number of parallel processes to use
#
# @return [Fixnum]
def parallel_processes
Copy link
Collaborator

Choose a reason for hiding this comment

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

I realize this isn't changed in this diff, but I wondered why this needs to be an instance method?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Its a helper method, and I do not want to make it part of the public API of the corpus class just to avoid having it as a helper method.

No Public API > "Bad" private API.

@mbj
Copy link
Owner Author

mbj commented Dec 31, 2015

You can also remove core/regexp/shared/new.rb from the excludes in the rubyspec integration since that file was deleted in ruby/spec@9614f25

I wounder if the code should raise when an exclude does NOT trigger. But will delay that for the next iteration.

@mbj
Copy link
Owner Author

mbj commented Dec 31, 2015

@backus Redundant exclude removed.

@dkubb Ready for the next pass.

dkubb added a commit that referenced this pull request Dec 31, 2015
@dkubb dkubb merged commit bb4d4d9 into master Dec 31, 2015
@dkubb dkubb deleted the fix/rubyspec-location branch December 31, 2015 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants