Closed cgewecke closed 6 years ago
The whole parseImports
mechanism is built around a special JS callback that's documented here. Not sure what we'd do instead because I don't see a comparable parsing option in the command line solc docs. We have quite a bit of pre-processing that doesn't necessarily fit into the way command-line solc is designed? Idk.
The whole
parseImports
mechanism is built around a special JS callback that's documented here. Not sure what we'd do instead because I don't see a comparable parsing option in the command line solc docs. We have quite a bit of pre-processing that doesn't necessarily fit into the way command-line solc is designed? Idk.
That's fascinating! Thanks for filling in the gaps in my mental model of this stuff.
Doing a bit of investigating for my own curiosity, this comment seems to suggest we'd be able to avoid using that callback, given a bit of extra trouble.
Trying this out with the native solc
, it looks like we could search for import errors ourselves - see gist.
Not saying it's worth the effort, but it might be later.
@gnidan Yes agree this definitely seems possible. . .
Thought a bit more about this - probably worth profiling and might also require we revise the minimization algo to reduce computational complexity.
My impression while debugging for the PR was that solcjs parses this stuff very quickly ( ~ 1 sec for Zeppelin). parseImports
runs for each file (potentially more than once in normal use). If solc is a docker
this might be bad because spin-up could be in the 300ms - 900ms range depending on OS. We'd want to do that once, and possibly not at all.
Would be nice if solc
exposed the parser as a separate piece of functionality.
@cgewecke ah, thanks for following up to find that out. Unfortunate that solc
doesn't just expose the parser. I'll ask them if I should open an issue for that.
Fixes #64.
Uses solcjs to resolve import paths when running a built compiler. Solcjs needs to be matched to the built version, so the first time a built compiler runs there's additional overhead for the remote fetch (~5 sec). That said running with
docker
is more than twice as fast. Native might be faster. Zeppelin's entire suite (dozens of contracts) compiles in ~11 seconds vs. ~27 seconds (JS) on my box. Import parsing overhead without the fetch seems negligible, ~1 sec.Also:
get
built compilers into a single method