Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants