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

feat(solc): add support for compiling solc in parallel #652

Merged
merged 14 commits into from
Dec 6, 2021

Conversation

mattsse
Copy link
Collaborator

@mattsse mattsse commented Dec 6, 2021

Motivation

If the svm feature is used, contracts are grouped by their required solidity version and compiled separately. Instead of processing this sequentially, we can spawn multiple processes concurrently using the async_compile functions which is faster.

Solution

  • Add Solc::compile_many -> CompileMany which effectively works like a FuturesUnordered capped at a certain number, (num_cpus in our case).
  • add a job parameter in Project which sets this threshold, (default, num_cpu)
  • when calling svm_compile we check if we can use compile_many and use that instead

I was able to unify some stuff and refactor some things, but there is probably still some code duplication in those to branches (jobs == 1 || jobs > 1) when it comes to artifact and cache handling.

needs some further testing with forge.

PR Checklist

  • Added Tests
  • Added Documentation
  • Updated the changelog

Copy link
Owner

@gakonst gakonst left a comment

Choose a reason for hiding this comment

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

lgtm - pending further performance improvements on a per-file level

@gakonst gakonst merged commit a9a47a4 into gakonst:master Dec 6, 2021
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.

None yet

2 participants