What is the behavior of solc with optimizer disabled?












1















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?










share|improve this question

























  • 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
    9 hours ago


















1















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?










share|improve this question

























  • 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
    9 hours ago
















1












1








1








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?










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 8 hours ago









Rick Park

1,109214




1,109214










asked 9 hours ago









junizjuniz

325




325













  • 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
    9 hours ago





















  • 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
    9 hours ago



















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
9 hours ago







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
9 hours ago












1 Answer
1






active

oldest

votes


















2














The default is “I do not care about gas, on deployment or 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 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!






share|improve this answer























    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
    });


    }
    });














    draft saved

    draft discarded


















    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









    2














    The default is “I do not care about gas, on deployment or 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 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!






    share|improve this answer




























      2














      The default is “I do not care about gas, on deployment or 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 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!






      share|improve this answer


























        2












        2








        2







        The default is “I do not care about gas, on deployment or 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 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!






        share|improve this answer













        The default is “I do not care about gas, on deployment or 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 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!







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 8 hours ago









        Rick ParkRick Park

        1,109214




        1,109214






























            draft saved

            draft discarded




















































            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.




            draft saved


            draft discarded














            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





















































            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