aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-05-02 23:54:51 +0800
committerGitHub <noreply@github.com>2018-05-02 23:54:51 +0800
commit42d6547bded732c39ee921e691c3a18a1d52fc80 (patch)
tree8500ca5c51a2836dc3e8b8e0c061bb3e9eeeeb32
parente681f4ee7924ebc419e0bd878b8640c63b17a0c8 (diff)
parent1367fedfd0fc1d83aa9d51d9fe9e31df1eb1ac2a (diff)
downloaddexon-solidity-42d6547bded732c39ee921e691c3a18a1d52fc80.tar
dexon-solidity-42d6547bded732c39ee921e691c3a18a1d52fc80.tar.gz
dexon-solidity-42d6547bded732c39ee921e691c3a18a1d52fc80.tar.bz2
dexon-solidity-42d6547bded732c39ee921e691c3a18a1d52fc80.tar.lz
dexon-solidity-42d6547bded732c39ee921e691c3a18a1d52fc80.tar.xz
dexon-solidity-42d6547bded732c39ee921e691c3a18a1d52fc80.tar.zst
dexon-solidity-42d6547bded732c39ee921e691c3a18a1d52fc80.zip
Merge pull request #4048 from JonnyBurger/develop
Improve documentation and CLI help for `--run` parameter
-rw-r--r--docs/using-the-compiler.rst11
-rw-r--r--solc/CommandLineInterface.cpp3
2 files changed, 10 insertions, 4 deletions
diff --git a/docs/using-the-compiler.rst b/docs/using-the-compiler.rst
index df30b6b4..1d7cb97b 100644
--- a/docs/using-the-compiler.rst
+++ b/docs/using-the-compiler.rst
@@ -14,7 +14,9 @@ Using the Commandline Compiler
One of the build targets of the Solidity repository is ``solc``, the solidity commandline compiler.
Using ``solc --help`` provides you with an explanation of all options. The compiler can produce various outputs, ranging from simple binaries and assembly over an abstract syntax tree (parse tree) to estimations of gas usage.
-If you only want to compile a single file, you run it as ``solc --bin sourceFile.sol`` and it will print the binary. Before you deploy your contract, activate the optimizer while compiling using ``solc --optimize --bin sourceFile.sol``. If you want to get some of the more advanced output variants of ``solc``, it is probably better to tell it to output everything to separate files using ``solc -o outputDirectory --bin --ast --asm sourceFile.sol``.
+If you only want to compile a single file, you run it as ``solc --bin sourceFile.sol`` and it will print the binary. If you want to get some of the more advanced output variants of ``solc``, it is probably better to tell it to output everything to separate files using ``solc -o outputDirectory --bin --ast --asm sourceFile.sol``.
+
+Before you deploy your contract, activate the optimizer while compiling using ``solc --optimize --bin sourceFile.sol``. By default, the optimizer will optimize the contract for 200 runs. If you want to optimize for initial contract deployment and get the smallest output, set it to ``--runs=1``. If you expect many transactions and don't care for higher deployment cost and output size, set ``--runs`` to a high number.
The commandline compiler will automatically read imported files from the filesystem, but
it is also possible to provide path redirects using ``prefix=path`` in the following way:
@@ -96,10 +98,13 @@ Input Description
{
// Optional: Sorted list of remappings
remappings: [ ":g/dir" ],
- // Optional: Optimizer settings (enabled defaults to false)
+ // Optional: Optimizer settings
optimizer: {
+ // disabled by default
enabled: true,
- runs: 500
+ // Optimize for how many times you intend to run the code.
+ // Lower values will optimize more for initial deployment cost, higher values will optimize more for high-frequency usage.
+ runs: 200
},
evmVersion: "byzantium", // Version of the EVM to compile for. Affects type checking and code generation. Can be homestead, tangerineWhistle, spuriousDragon, byzantium or constantinople
// Metadata settings (optional)
diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp
index bd5e2eb1..1f04c68a 100644
--- a/solc/CommandLineInterface.cpp
+++ b/solc/CommandLineInterface.cpp
@@ -564,7 +564,8 @@ Allowed options)",
(
g_argOptimizeRuns.c_str(),
po::value<unsigned>()->value_name("n")->default_value(200),
- "Estimated number of contract runs for optimizer tuning."
+ "Set for how many contract runs to optimize."
+ "Lower values will optimize more for initial deployment cost, higher values will optimize more for high-frequency usage."
)
(g_argPrettyJson.c_str(), "Output JSON in pretty format. Currently it only works with the combined JSON output.")
(