-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Description
Description
I am attaching 2 standard JSON input files. Both of them include two sources. One of them (src/contract.sol) is a Uniswap V3 position manager (can be any contract that takes at least some time to compile). Second is a contract containing a single import directive, importing the heavy contract (import "src/contract.sol";)
In first input, bytecode output selection is requested for both contracts, and in second input - only for the second one.
Expected behavior
I would expect solc to skip compiling contracts which are excluded from output selection unless they appear as a bytecode dependency (new keyword or .creationCode) in some of the included contracts.
Actual behavior
It seems that both inputs take a similar pretty long time to compile event though second input basically just compiles an empty source, and outputs nothing. I assume it spends time compiling imported heavy contract
$ time cat input1.json | solc --standard-json
solc --standard-json 3.49s user 0.09s system 96% cpu 3.707 total
$ time cat input2.json | solc --standard-json
solc --standard-json 3.49s user 0.07s system 99% cpu 3.597 total
Fixing this would mean a potentially very high compile time optimization. Right now, even if tooling resolves contract dependecies, and excludes all of them from output selection, solc still spends time compiling and optimizing unused dependencies, even though the resulted bytecode is not outputted at all.
Environment
- Compiler version: 0.8.26
- Target EVM version (as per compiler settings): Paris
- Operating system: macOS