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

Don't fully compiler/check imports. #2862

Closed
MicahZoltu opened this issue Sep 1, 2017 · 8 comments
Closed

Don't fully compiler/check imports. #2862

MicahZoltu opened this issue Sep 1, 2017 · 8 comments

Comments

@MicahZoltu
Copy link
Contributor

At the moment, it appears that Solidity is doing a full check/compile of imported contracts. However, it could save notable time by instead just parsing enough to get the contracts and function signatures which is all that is needed by the importer.

Compilation time on some of my contracts is up to minutes because the import hierarchy is large. I would really like to get this number down, and one way would be if imported contracts weren't fully compiled and instead were just parsed.

@chriseth
Copy link
Contributor

chriseth commented Sep 1, 2017

The main reason for this is that there is not yet a way to specify which contract you actually want to have compiled (there is an open issue about that and I think @axic started an implementation). For the normal commandline solc, we could compile just the contracts in the first source file specified, but that won't work for all versions.

What you could do is use interfaces, basically the same workaround C is using with its header files. It's not nice, but at least it will help until we have the proper solution.

@MicahZoltu
Copy link
Contributor Author

That is our current planned workaround, but as anyone who has worked with C knows its quite the PITA to maintain duplicates of every file.

@axic
Copy link
Member

axic commented Sep 1, 2017

I don think headers are duplicates, they have a different purpose. Similarly, interfaces have their own distinct purpose. Though I must admit that I do not know your situation and the codebase you are working on.

@chriseth
Copy link
Contributor

chriseth commented Sep 1, 2017

I also think this should be solved in collaboration with the package managers - for example truffle seems to call the compiler once for each source file, while a single call for everything should be enough.

@axic perhaps we could implement the output selection to a point where you specify a single file and just want everything from there, since this seems to be the feature required by truffle. More fine-grained control can be added later.

@MicahZoltu
Copy link
Contributor Author

Our (Augur's) build/test pipeline is pretty naive right now. At the moment it compiles each file separately, rather than compiling the whole project. This could be improved such that we compile the entire project in one call to solc rather than compiling each independently. Right now I'm going through the codebase and making everything have a separate Interface file and the compilation times are decreasing by 60-100 fold.

@axic
Copy link
Member

axic commented Oct 30, 2020

@chriseth @MicahZoltu Is this issue solved by #8739 ?

@MicahZoltu
Copy link
Contributor Author

I'll defer to @chriseth on that. I'm not actively working on the aforementioned project anymore so I wouldn't be able to help test.

@chriseth
Copy link
Contributor

chriseth commented Nov 2, 2020

I would say we can close it.

@chriseth chriseth closed this as completed Nov 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants