What is the behavior of solc with optimizer disabled?
When enabling the optimizer the documentation of solc tells you that you can choose between optimizing the gas cost at deployment or the gas cost at execution by setting the runs parameter.
But what is the default behavior when the optimizer is disabled? Will the compiled bytecode lead to high gas cost of deployment AND high gas cost fo execution, or can we assume that it leads by default to high gas cost of deployment but low for gas cost of execution?
solidity truffle solc
add a comment |
When enabling the optimizer the documentation of solc tells you that you can choose between optimizing the gas cost at deployment or the gas cost at execution by setting the runs parameter.
But what is the default behavior when the optimizer is disabled? Will the compiled bytecode lead to high gas cost of deployment AND high gas cost fo execution, or can we assume that it leads by default to high gas cost of deployment but low for gas cost of execution?
solidity truffle solc
It's probably equivalent tooptimize=falseANDruns=0, so you can do the math from here ((i.e., if increasingrunsreduces execution gas cost, then decreasingrunswill enlarge execution gas cost).
– goodvibration
Jan 21 at 9:30
add a comment |
When enabling the optimizer the documentation of solc tells you that you can choose between optimizing the gas cost at deployment or the gas cost at execution by setting the runs parameter.
But what is the default behavior when the optimizer is disabled? Will the compiled bytecode lead to high gas cost of deployment AND high gas cost fo execution, or can we assume that it leads by default to high gas cost of deployment but low for gas cost of execution?
solidity truffle solc
When enabling the optimizer the documentation of solc tells you that you can choose between optimizing the gas cost at deployment or the gas cost at execution by setting the runs parameter.
But what is the default behavior when the optimizer is disabled? Will the compiled bytecode lead to high gas cost of deployment AND high gas cost fo execution, or can we assume that it leads by default to high gas cost of deployment but low for gas cost of execution?
solidity truffle solc
solidity truffle solc
edited Jan 21 at 10:26
Rick Park
1,224214
1,224214
asked Jan 21 at 9:22
junizjuniz
395
395
It's probably equivalent tooptimize=falseANDruns=0, so you can do the math from here ((i.e., if increasingrunsreduces execution gas cost, then decreasingrunswill enlarge execution gas cost).
– goodvibration
Jan 21 at 9:30
add a comment |
It's probably equivalent tooptimize=falseANDruns=0, so you can do the math from here ((i.e., if increasingrunsreduces execution gas cost, then decreasingrunswill enlarge execution gas cost).
– goodvibration
Jan 21 at 9:30
It's probably equivalent to
optimize=false AND runs=0, so you can do the math from here ((i.e., if increasing runs reduces execution gas cost, then decreasing runs will enlarge execution gas cost).– goodvibration
Jan 21 at 9:30
It's probably equivalent to
optimize=false AND runs=0, so you can do the math from here ((i.e., if increasing runs reduces execution gas cost, then decreasing runs will enlarge execution gas cost).– goodvibration
Jan 21 at 9:30
add a comment |
1 Answer
1
active
oldest
votes
The default is “I do not care about gas consumption, not when deploying and not when running. Just give me a bytecode easy to debug.”
As a matter of fact the code size shall be bigger than the minimum and the execution cost shall be bigger than the minimum, but the mapping from source code to bytecode shall be as detailed and straight and clear as it can be.
“Runs” can be interpreted as the expected number of runs of the deployed code in the whole life of the contract to be optimized.
If you specify Runs=10 it means that any optimization that make it globally less costly to deploy and run ten times the code are allowed. And this can be very different than optimize one deploy and 1000 executions!
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "642"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fethereum.stackexchange.com%2fquestions%2f65881%2fwhat-is-the-behavior-of-solc-with-optimizer-disabled%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The default is “I do not care about gas consumption, not when deploying and not when running. Just give me a bytecode easy to debug.”
As a matter of fact the code size shall be bigger than the minimum and the execution cost shall be bigger than the minimum, but the mapping from source code to bytecode shall be as detailed and straight and clear as it can be.
“Runs” can be interpreted as the expected number of runs of the deployed code in the whole life of the contract to be optimized.
If you specify Runs=10 it means that any optimization that make it globally less costly to deploy and run ten times the code are allowed. And this can be very different than optimize one deploy and 1000 executions!
add a comment |
The default is “I do not care about gas consumption, not when deploying and not when running. Just give me a bytecode easy to debug.”
As a matter of fact the code size shall be bigger than the minimum and the execution cost shall be bigger than the minimum, but the mapping from source code to bytecode shall be as detailed and straight and clear as it can be.
“Runs” can be interpreted as the expected number of runs of the deployed code in the whole life of the contract to be optimized.
If you specify Runs=10 it means that any optimization that make it globally less costly to deploy and run ten times the code are allowed. And this can be very different than optimize one deploy and 1000 executions!
add a comment |
The default is “I do not care about gas consumption, not when deploying and not when running. Just give me a bytecode easy to debug.”
As a matter of fact the code size shall be bigger than the minimum and the execution cost shall be bigger than the minimum, but the mapping from source code to bytecode shall be as detailed and straight and clear as it can be.
“Runs” can be interpreted as the expected number of runs of the deployed code in the whole life of the contract to be optimized.
If you specify Runs=10 it means that any optimization that make it globally less costly to deploy and run ten times the code are allowed. And this can be very different than optimize one deploy and 1000 executions!
The default is “I do not care about gas consumption, not when deploying and not when running. Just give me a bytecode easy to debug.”
As a matter of fact the code size shall be bigger than the minimum and the execution cost shall be bigger than the minimum, but the mapping from source code to bytecode shall be as detailed and straight and clear as it can be.
“Runs” can be interpreted as the expected number of runs of the deployed code in the whole life of the contract to be optimized.
If you specify Runs=10 it means that any optimization that make it globally less costly to deploy and run ten times the code are allowed. And this can be very different than optimize one deploy and 1000 executions!
edited Jan 21 at 22:45
answered Jan 21 at 10:24
Rick ParkRick Park
1,224214
1,224214
add a comment |
add a comment |
Thanks for contributing an answer to Ethereum Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fethereum.stackexchange.com%2fquestions%2f65881%2fwhat-is-the-behavior-of-solc-with-optimizer-disabled%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
It's probably equivalent to
optimize=falseANDruns=0, so you can do the math from here ((i.e., if increasingrunsreduces execution gas cost, then decreasingrunswill enlarge execution gas cost).– goodvibration
Jan 21 at 9:30