Open cgewecke opened 6 years ago
Profiled BYOC running on docker vs latest Zeppelin (107 contracts) and didn't see too much on the JS side that consumed a lot of resources. Top level looks like this:
ticks parent name
5053 36.5% t node::(anonymous namespace)::ContextifyScript::New(v8::FunctionCallbackInfo<v8::Value> const&)
5053 100.0% T v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*)
5019 99.3% LazyCompile: ~Script vm.js:46:14
5019 100.0% LazyCompile: ~createScript vm.js:137:22
5019 100.0% LazyCompile: ~runInThisContext vm.js:198:26
5019 100.0% LazyCompile: ~Module._compile module.js:617:37
4347 31.4% T node::SyncProcessRunner::Spawn(v8::FunctionCallbackInfo<v8::Value> const&)
4347 100.0% T v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*)
4347 100.0% LazyCompile: ~spawnSync internal/child_process.js:947:19
4347 100.0% LazyCompile: ~spawnSync child_process.js:515:19
4347 100.0% LazyCompile: ~execSync child_process.js:602:18
2271 52.2% LazyCompile: ~CompilerProvider.validateDocker /Users/cgewecke/code/consensys/zeppelin-solidity/node_modules/darq-truffle/build/cli.bundled.js:140578:53
2076 47.8% LazyCompile: ~compileStandard /Users/cgewecke/code/consensys/zeppelin-solidity/node_modules/darq-truffle/build/cli.bundled.js:140553:26
986 7.1% t node::Read(v8::FunctionCallbackInfo<v8::Value> const&)
986 100.0% T v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*)
986 100.0% LazyCompile: ~fs.readSync fs.js:688:23
986 100.0% LazyCompile: ~tryReadSync fs.js:553:21
986 100.0% LazyCompile: ~fs.readFileSync fs.js:565:27
973 98.7% LazyCompile: ~Module._extensions..js module.js:669:37
ContextifyScript
is some kind of mysterious catch all for node, possibly related to requiring
? Believe management of require has come up before as way of improving performance.
~15% of the time is spent asking docker what version it is. . . .:/
[EDIT -- UPDATE]
Modifying the CompilerProvider to fetch solc by require (vs. reading from cached file and using require-from-string
) resulted in this:
ticks parent name
4425 45.9% T node::SyncProcessRunner::Spawn(v8::FunctionCallbackInfo<v8::Value> const&)
4425 100.0% T v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*)
4425 100.0% LazyCompile: ~spawnSync internal/child_process.js:947:19
4425 100.0% LazyCompile: ~spawnSync child_process.js:515:19
4425 100.0% LazyCompile: ~execSync child_process.js:602:18
2410 54.5% LazyCompile: ~compileStandard /Users/cgewecke/code/consensys/zeppelin-solidity/node_modules/darq-truffle/build/cli.bundled.js:140553:26
2015 45.5% LazyCompile: ~CompilerProvider.validateDocker /Users/cgewecke/code/consensys/zeppelin-solidity/node_modules/darq-truffle/build/cli.bundled.js:140578:53
2334 24.2% t node::(anonymous namespace)::ContextifyScript::New(v8::FunctionCallbackInfo<v8::Value> const&)
2334 100.0% T v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*)
2292 98.2% LazyCompile: ~Script vm.js:46:14
2292 100.0% LazyCompile: ~createScript vm.js:137:22
2292 100.0% LazyCompile: ~runInThisContext vm.js:198:26
2292 100.0% LazyCompile: ~Module._compile module.js:617:37
.... etc ....
We should get significant speedup (30%?) if we
require-from-string
(See this for possible solution).
See discussion at #64.
In that PR solcjs is used to run
parseImports
. We might be able to do this using the native compiler more quickly if we re-org things a bit. . . Also see #36 and make sure we're doing what is advised there.