Why doesnt JIT compiler ( Java ) save the results?












4















As I studied about JIT compiler from here:
What does a just-in-time (JIT) compiler do?
and




there's no *.exe or *.dll generated by the Java JIT for Windows. It
writes the processor instructions to memory (RAM) and runs it from
there. There's no need to create a separate PE file with file-headers
and everything




My question is WHY doesn't JIT compiler ( Java ) save the results? Isn't it useful to store compiled code to save time for the next launch?



(My question is different from the mentioned above, because I emphasized on WHY)










share|improve this question


















  • 1





    I don't think this is an inherently bad question, but only a developer of an actual JVM would be able to answer for certain. Most likely, it's because saving the internal JVM state would be an extremely tricky operation; that said, check into GraalVM.

    – chrylis
    Jan 3 at 7:49
















4















As I studied about JIT compiler from here:
What does a just-in-time (JIT) compiler do?
and




there's no *.exe or *.dll generated by the Java JIT for Windows. It
writes the processor instructions to memory (RAM) and runs it from
there. There's no need to create a separate PE file with file-headers
and everything




My question is WHY doesn't JIT compiler ( Java ) save the results? Isn't it useful to store compiled code to save time for the next launch?



(My question is different from the mentioned above, because I emphasized on WHY)










share|improve this question


















  • 1





    I don't think this is an inherently bad question, but only a developer of an actual JVM would be able to answer for certain. Most likely, it's because saving the internal JVM state would be an extremely tricky operation; that said, check into GraalVM.

    – chrylis
    Jan 3 at 7:49














4












4








4








As I studied about JIT compiler from here:
What does a just-in-time (JIT) compiler do?
and




there's no *.exe or *.dll generated by the Java JIT for Windows. It
writes the processor instructions to memory (RAM) and runs it from
there. There's no need to create a separate PE file with file-headers
and everything




My question is WHY doesn't JIT compiler ( Java ) save the results? Isn't it useful to store compiled code to save time for the next launch?



(My question is different from the mentioned above, because I emphasized on WHY)










share|improve this question














As I studied about JIT compiler from here:
What does a just-in-time (JIT) compiler do?
and




there's no *.exe or *.dll generated by the Java JIT for Windows. It
writes the processor instructions to memory (RAM) and runs it from
there. There's no need to create a separate PE file with file-headers
and everything




My question is WHY doesn't JIT compiler ( Java ) save the results? Isn't it useful to store compiled code to save time for the next launch?



(My question is different from the mentioned above, because I emphasized on WHY)







java jit






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 3 at 7:30









Axel CoonAxel Coon

458




458








  • 1





    I don't think this is an inherently bad question, but only a developer of an actual JVM would be able to answer for certain. Most likely, it's because saving the internal JVM state would be an extremely tricky operation; that said, check into GraalVM.

    – chrylis
    Jan 3 at 7:49














  • 1





    I don't think this is an inherently bad question, but only a developer of an actual JVM would be able to answer for certain. Most likely, it's because saving the internal JVM state would be an extremely tricky operation; that said, check into GraalVM.

    – chrylis
    Jan 3 at 7:49








1




1





I don't think this is an inherently bad question, but only a developer of an actual JVM would be able to answer for certain. Most likely, it's because saving the internal JVM state would be an extremely tricky operation; that said, check into GraalVM.

– chrylis
Jan 3 at 7:49





I don't think this is an inherently bad question, but only a developer of an actual JVM would be able to answer for certain. Most likely, it's because saving the internal JVM state would be an extremely tricky operation; that said, check into GraalVM.

– chrylis
Jan 3 at 7:49












1 Answer
1






active

oldest

votes


















4














The ouput of a JIT may be different for each run - it can optimize for the current load pattern. This sometimes allows it to optimize more agressively than what would be possible for pre-compiled code that needs to be reusable.



If the load-pattern changes and the optimization is found to be sub-optimal or even adverse, a JIT can de-optimize and possibly attempt a different optimization



(see also About the dynamic de-optimization of HotSpot)



Now, it might sometimes save some performance to keep these results of various compiled versions around and reuse them later, but it would also require a significant amount of book-keeping to be able to find out if a section of code has already been compiled with currently relevant optimizations.



I suppose that is just not considered worth the effort. Its a tradeoff between doing file-IO and usually fast compilation of small sections of code.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    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: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    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%2fstackoverflow.com%2fquestions%2f54018070%2fwhy-doesnt-jit-compiler-java-save-the-results%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









    4














    The ouput of a JIT may be different for each run - it can optimize for the current load pattern. This sometimes allows it to optimize more agressively than what would be possible for pre-compiled code that needs to be reusable.



    If the load-pattern changes and the optimization is found to be sub-optimal or even adverse, a JIT can de-optimize and possibly attempt a different optimization



    (see also About the dynamic de-optimization of HotSpot)



    Now, it might sometimes save some performance to keep these results of various compiled versions around and reuse them later, but it would also require a significant amount of book-keeping to be able to find out if a section of code has already been compiled with currently relevant optimizations.



    I suppose that is just not considered worth the effort. Its a tradeoff between doing file-IO and usually fast compilation of small sections of code.






    share|improve this answer




























      4














      The ouput of a JIT may be different for each run - it can optimize for the current load pattern. This sometimes allows it to optimize more agressively than what would be possible for pre-compiled code that needs to be reusable.



      If the load-pattern changes and the optimization is found to be sub-optimal or even adverse, a JIT can de-optimize and possibly attempt a different optimization



      (see also About the dynamic de-optimization of HotSpot)



      Now, it might sometimes save some performance to keep these results of various compiled versions around and reuse them later, but it would also require a significant amount of book-keeping to be able to find out if a section of code has already been compiled with currently relevant optimizations.



      I suppose that is just not considered worth the effort. Its a tradeoff between doing file-IO and usually fast compilation of small sections of code.






      share|improve this answer


























        4












        4








        4







        The ouput of a JIT may be different for each run - it can optimize for the current load pattern. This sometimes allows it to optimize more agressively than what would be possible for pre-compiled code that needs to be reusable.



        If the load-pattern changes and the optimization is found to be sub-optimal or even adverse, a JIT can de-optimize and possibly attempt a different optimization



        (see also About the dynamic de-optimization of HotSpot)



        Now, it might sometimes save some performance to keep these results of various compiled versions around and reuse them later, but it would also require a significant amount of book-keeping to be able to find out if a section of code has already been compiled with currently relevant optimizations.



        I suppose that is just not considered worth the effort. Its a tradeoff between doing file-IO and usually fast compilation of small sections of code.






        share|improve this answer













        The ouput of a JIT may be different for each run - it can optimize for the current load pattern. This sometimes allows it to optimize more agressively than what would be possible for pre-compiled code that needs to be reusable.



        If the load-pattern changes and the optimization is found to be sub-optimal or even adverse, a JIT can de-optimize and possibly attempt a different optimization



        (see also About the dynamic de-optimization of HotSpot)



        Now, it might sometimes save some performance to keep these results of various compiled versions around and reuse them later, but it would also require a significant amount of book-keeping to be able to find out if a section of code has already been compiled with currently relevant optimizations.



        I suppose that is just not considered worth the effort. Its a tradeoff between doing file-IO and usually fast compilation of small sections of code.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 3 at 7:58









        HulkHulk

        3,42812142




        3,42812142
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • 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%2fstackoverflow.com%2fquestions%2f54018070%2fwhy-doesnt-jit-compiler-java-save-the-results%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







            Popular posts from this blog

            Monofisismo

            Angular Downloading a file using contenturl with Basic Authentication

            Olmecas