Docker compilation twice as slow, seems to hang on large contract sets.
See original GitHub issue- I’ve asked for help in the Truffle Gitter before filing this issue.
Issue
5.0.13 significantly reduced the speed of solc docker compilation for large contract sets. Performance when compiling colonyNetwork on a MacBook Air 1.8 ghz:
- 5.0.12 time --> real 0m59.960s
- 5.0.17 time --> real 2m22.203s
The command also hangs before listing the contracts for more than a minute. Believe changes to the imports parsing / profiler in #1913 are the cause. The benefit of the solcjs parsing removed in that PR was that it was fast (see this tcoulter comment from the original implementation).
Steps to Reproduce
# Install colonyNetwork
git clone https://github.com/JoinColony/colonyNetwork.git
cd colonyNetwork
yarn
git submodule update --init
# Install Truffle 5.0.12 and benchmark
npm uninstall -g truffle
npm install truffle@5.0.12
time truffle compile
# Clean build
rm -rf build
# Install Truffle 5.0.17 and benchmark
npm uninstall -g truffle
npm install truffle@5.0.17
time truffle compile
Expected Behavior
Using solc docker is faster than using solc-js
Additional notes / suggestion
#1913 resolved several issues. #1720 is one but it also allowed openzeppelin-solidity to run a solc nightly job. Previous versions of truffle had been unable to meet that use case because they couldn’t match a solc-js companion to the commit referenced by the docker nightly tag.
There might be a simple internal fix for this but one option is to go back to using a js parser for imports parsing. solidity-parser-antlr is excellent and widely used across the js eco-system. It would be nice if it received grant support and was treated as a core piece of the stack.
The risks of depending on a parser which lags solidity development (slightly) could be mitigated by E2E testing here, having a strong relationship with the project’s maintainer and maybe asking solc to ping solidity-antrl4 with grammar changes. Perhaps they could integrate it with their own testing or even add it as a dependency to the npm published solcjs.
Environment
- Operating System: OSX
- Ethereum client: N/A
- Truffle version (
truffle version
): 5.0.12 / 5.0.17 - node version (
node --version
): 10.15.3 - npm version (
npm --version
): 6.4.1
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:14 (8 by maintainers)
Hey @drortirosh , I notice the truffle config in the referenced repo doesn’t include the new config setting for speedy parsing.
For reference from #2067 :
Hope this helps!
Alas, it was not solved. I’m working with truffle 5.0.27 Below are my tests for
truffle compile
, for a project with 9 contracts and few referenced libs (https://github.com/tabookey/tabookey-gasless/)with docker: 34 seconds without docker (solcjs) : 10 seconds with solc docker (without truffle) - 1.2 seconds
Note that the solc generates different output format (the above test was with
--combined-json
with all options set, though truffle generates much more verbose info.I’m using Mac, where I can see the currently running process. When running
truffle compile
with “docker” enabled:I’m not sure what takes so long, and why the docker image was executed twice (one run can compile all contracts, and anyway, my project had ~10 contracts, including some references to libraries)