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

Use stream instead of parallelStream #437

Merged
merged 1 commit into from
May 4, 2017
Merged

Conversation

runningcode
Copy link
Contributor

The overhead of creating threads for very small tasks might not be
faster than performing the same tasks serially.

I ran a benchmark using this commit against our repo. I killed the
gradle daemon and then ran the okbuck task 3 times.

Before: using parallel()
20.353 secs
6.644 secs
5.89 secs

After: using stream()
18.539 secs
6.316 secs
5.613 secs

The results were quite similar with and without parallel stream. I'm
wondering if there is any noticeable difference with even larger projects.

@kageiit
Copy link
Contributor

kageiit commented May 4, 2017

Ran it on our codebase

Before:

Total time: 53.786 secs
Total time: 34.565 secs
Total time: 32.101 secs

After

Total time: 51.386 secs
Total time: 34.451 secs
Total time: 30.859 secs

Looks good

@@ -46,7 +46,7 @@ task sourcesJar(type: Jar) {
classifier = 'sources'
}

def publishVersion = '0.20.7'
def publishVersion = '0.20.8-SNAPSHOT'
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you revert this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Isn't it typical to bump the version to the next release snapshot? This makes it easier to test changes locally.

Copy link
Contributor

Choose a reason for hiding this comment

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

you can do so if you want to locally. Even if we wanted to start doing that, it should be a separate change

The overhead of creating threads for very small tasks might not be
faster than performing the same tasks serially.

I ran a benchmark using this commit against our repo. I killed the
gradle daemon and then ran the okbuck task 3 times.

Before: using parallel()
20.353 secs
6.644 secs
5.89 secs

After: using stream()
18.539 secs
6.316 secs
5.613 secs

The results were quite similar with and without parallel stream. I'm
wondering if there is any noticeable difference with even larger projects.
@runningcode
Copy link
Contributor Author

Removed snapshot version!

@kageiit kageiit merged commit e8e8666 into uber:master May 4, 2017
@runningcode runningcode deleted the no/parallel branch May 4, 2017 22:46
cwoodwar6 pushed a commit to cwoodwar6/okbuck that referenced this pull request May 10, 2017
* uber/master:
  Use stream instead of parallelStream (uber#437)
  Add empty resource rule if using resource union. (uber#438)
  Publich v0.20.7
  Move okbuck task to its own gradle task class. (uber#436)
  Use try-with-resources (uber#432)
  Update README.md
  Do not allow okbuck to be run without okbuck.wrapper set to true. (uber#433)
  Set descriptions in tasks class instead of when creating them. (uber#431)
  Move cleaning the .okbuck/gen folder to the first step of setupOkbuck. (uber#430)
  Publish v0.20.6
  Add support for downloading 22-25 API robolectric runtime dependencies. (uber#427)
  Skip okbuck if we just want to kill the buck daemon. (uber#425)
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