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

Optimize knownProducts for direct-to-JAR compilation #939

Merged
merged 3 commits into from
Nov 9, 2020

Conversation

retronym
Copy link
Member

@retronym retronym commented Nov 3, 2020

Fixes #933

@retronym retronym marked this pull request as ready for review November 3, 2020 08:03
Comment on lines 1101 to 1102
def knownProductsPar =
if (AnalysisCallback.parallelKnownProducts) new ParVector(knownProducts) else knownProducts
Copy link
Member

Choose a reason for hiding this comment

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

Does this use the default fork/join scheduler? If so, could it end up competing against other tasks or potentially other Zinc compilation that are also trying to do the same thing? Or it finishes quickly enough that it won't surface? (But takes long enough time if it's not parallelized?)

Copy link
Member

Choose a reason for hiding this comment

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

Looks like I added the parallel thing in 94ba81e, but I'd be happy to see it gone if it's not working.

Copy link
Member Author

@retronym retronym Nov 9, 2020

Choose a reason for hiding this comment

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

In this case I think the best idea is to keep it sequential. If this is a bottle neck, we can try to first reduce the overhead in sequential code (like I've done here, but I'm sure there are more opportunities.) Sequential code is a bit easier to profile and tune. Using parallelism should be done with a careful understanding of whether the task size suitable for parallel collections (e.g. something like (1 to 1000).par.count(_ % 2 == 0) is slower than the sequential version.

I've added a commit to remove the ParVector altogether.

@eed3si9n eed3si9n merged commit 6bcaba0 into sbt:develop Nov 9, 2020
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.

Performance improvement ideas for Zinc 1.4.x
2 participants