question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
CruzMolinacommented, Jul 29, 2019

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 :

To enable speedy JS parsing, users will need to specify a parser: "solcjs" key/value pair in their config like so:

module.exports = {
  compilers: {
    solc: {
      parser: "solcjs"
    }
  }  
}

Hope this helps!

1reaction
drortiroshcommented, Jul 29, 2019

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:

  • 8 seconds of “truffle”
  • ~10 seconds running “docker”
  • ~10 seconds running again “docker”
  • few more seconds in “truffle” to “wrap up”

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)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Speed up Laravel in Docker by moving vendor directory
The reason behind this slow performance is two-fold, caused by the combination of the PHP request model and the latency when transferring data ......
Read more >
Faster Multi-Platform Builds: Dockerfile Cross-Compilation ...
When we start a build stage with a command like FROM debian it instructs the builder to pull the Debian image that matches...
Read more >
Java using much more memory than heap size (or size ...
How to size correctly the Docker memory limit? Is there a way to reduce the off-heap memory footprint of the Java process? I...
Read more >
Troubleshooting Omnibus GitLab installation issues
This error is thrown when /etc/gitlab/gitlab.rb configuration file contains configuration that is invalid or unsupported. Double check that there are no typos ...
Read more >
Amazon EC2 FAQs - Amazon Web Services
Amazon EC2 allows you to set up and configure everything about your ... with up to 192 vCPUs and 384 GiB of memory,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found