{"id":76094,"date":"2020-09-24T16:00:50","date_gmt":"2020-09-24T13:00:50","guid":{"rendered":"https:\/\/en.buradabiliyorum.com\/what-is-just-in-time-jit-compilation-cloudsavvy-it\/"},"modified":"2020-09-24T16:00:50","modified_gmt":"2020-09-24T13:00:50","slug":"what-is-just-in-time-jit-compilation-cloudsavvy-it","status":"publish","type":"post","link":"https:\/\/buradabiliyorum.com\/en\/what-is-just-in-time-jit-compilation-cloudsavvy-it\/","title":{"rendered":"#What Is Just-In-Time (JIT) Compilation? \u2013 CloudSavvy IT"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_85 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a42506a616a3\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #dd3333;color:#dd3333\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #dd3333;color:#dd3333\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a42506a616a3\" checked aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/buradabiliyorum.com\/en\/what-is-just-in-time-jit-compilation-cloudsavvy-it\/#Compilers_vs_Interpreters\" >Compilers vs. Interpreters<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/buradabiliyorum.com\/en\/what-is-just-in-time-jit-compilation-cloudsavvy-it\/#What_Does_JIT_Compilation_Do\" >What Does JIT Compilation Do?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/buradabiliyorum.com\/en\/what-is-just-in-time-jit-compilation-cloudsavvy-it\/#Does_JIT_Compilation_Have_a_Performance_Hit\" >Does JIT Compilation Have a Performance Hit?<\/a><\/li><\/ul><\/nav><\/div>\n<p><strong>&#8220;#What Is Just-In-Time (JIT) Compilation? \u2013 CloudSavvy IT&#8221;<\/strong><\/p>\n<div id=\"article-content-area\">\n<img loading=\"lazy\" decoding=\"async\" class=\"imgchk9 alignnone wp-image-6633 size-full\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/ddaec8c3e5b2c3e4f4c81a2ececadda4\/p\/uploads\/2020\/09\/08aed692.png\" alt=\"A high-level programming language\" width=\"700\" height=\"300\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Just-In-Time compilation, or JIT, is a technique used by runtime interpreters for languages like Java<a href=\"https:\/\/buradabiliyorum.com\/en\/category\/download-scripts-themes-apps\/\" data-internallinksmanager029f6b8e52c=\"9\" title=\"Download Scripts &amp; Themes &amp; Apps\" target=\"_blank\" rel=\"noopener\">Script<\/a>, C#, and Java to bring execution speeds closer to the native performance offered by precompiled binary languages like C++.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Compilers_vs_Interpreters\"><\/span>Compilers vs. Interpreters<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Computers don\u2019t know how to execute high-level programming languages like C++, at least not directly. In order to translate human-readable code into something your CPU can run, it must be converted. A computer usually does this through one of two methods\u2014compilation or interpretation.<\/p>\n<p>Compilation involves running a compiler, a program that takes source code and converts it into binary machine code, before running the application. The compilation takes place on the dev\u2019s computer before being packaged and sent out. Most executables that you download are compiled at some level to run on your machine, and compiled code is usually pretty fast because the compiler can make optimizations for your particular machine.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"imgchk9 alignnone wp-image-6915 size-full\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/1d7f293ba224efb79141d966e5fd4c32\/p\/uploads\/2020\/09\/0ed1ecda.png\" alt=\"A compiler takes source code and converts it into binary machine code before running the application\" width=\"700\" height=\"296\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>However, compilers have a few downsides. Programs must be compiled for specific CPU instructions sets (like x86-64 or ARM). On top of that, even operating systems that share instruction sets (like Windows and Linux, which both run on Intel CPUs) must have programs compiled separately due to the many differences in how they work.<\/p>\n<p>This means that for something like JavaScript, which must be sent over the internet to connected clients, it can\u2019t be compiled in advance, because the client could be running any combination of instruction set and operating system.<\/p>\n<p>Interpreters take a different approach. An interpreter is basically a software robot that takes the source code of a program like a JavaScript or Python script, and handles carrying out the execution at runtime.\u00a0It essentially acts as a middle layer between the source code and the machine, standing in where a compiler would translate it directly.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"imgchk9 alignnone wp-image-6916 size-full\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/19aed12eeeeed633ee7e48af8172f530\/p\/uploads\/2020\/09\/b4ccfd19.png\" alt=\"An interpreter takes the source code of a program and handles carrying out the execution at runtime.\" width=\"700\" height=\"325\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>This has the great benefit of not requiring the program to be built for any particular machine; as long as the machine can run the Python interpreter, it can run any Python scripts.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"What_Does_JIT_Compilation_Do\"><\/span>What Does JIT Compilation Do?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Unfortunately for interpreters, they\u2019re slow. A true interpreter must translate and handle every single instruction, essentially doing a compiler\u2019s job for every execution. That\u2019s a lot of overhead, so in reality, most interpreters like the V8 JavaScript engine, the Java Virtual Machine (JVM), and .NET\u2019s Common Language Runtime make use of Just-In-Time compilation to speed up the interpreter.<\/p>\n<p>Just-In-Time compilation is essentially a compiler that procrastinates, and only compiles the code for each function whenever it is needed. Whenever you call a function, if the JIT compiler hasn\u2019t seen it yet, it will compile that function (applying any optimizations for the machine it\u2019s running on), and run it. The next time you call the function, it already has the machine code on hand, so it just needs to look it up from the cache.<\/p>\n<p>Just-In-Time refers to the fact that the interpreter doesn\u2019t have to compile the whole app all at once. It certainly could, but for a large app it would lead to very high startup times. It\u2019s better for performance to only do compilation when it\u2019s needed (i.e., just in time).<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Does_JIT_Compilation_Have_a_Performance_Hit\"><\/span>Does JIT Compilation Have a Performance Hit?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>JIT is literally just a performance improvement over regular interpreters, so compared to not doing it at all, it\u2019s much faster. Compiling code isn\u2019t particularly fast though, so obviously doing compilation at runtime comes with a performance hit compared to if it was compiled directly to bytecode beforehand.<\/p>\n<p>However, because JIT compilation usually only has to be ran the first time a function is invoked, commonly used functions will only really see a performance hit on the first invocation. You can test this in C# with StopWatches\u2014they pick up .NET \u201cbackground noise,\u201d including the time spent doing JIT compilation on the first run of a function.<\/p>\n<p>The primary downside of JIT compiled applications is a high cold startup time, as thousands of functions called at startup must be compiled right at the start. Some ASP.NET web applications can take over a minute to bootstrap, in part due to high stress on the JIT compiler at the start.\n<\/p><\/div>\n<blockquote>\n<p style=\"text-align: center;\">For forums sites go to <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/forum.buradabiliyorum.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">Forum.BuradaBiliyorum.Com<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\"><strong>If you want to read more like this article, you can visit our <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/en.buradabiliyorum.com\/technology\/\" target=\"_blank\" rel=\"noopener noreferrer\">Technology category.<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<p><span style=\"color: black;\"><a style=\"color: #ff9900;\" href=\"https:\/\/www.cloudsavvyit.com\/6872\/what-is-just-in-time-jit-compilation\/\" target=\"_blank\" rel=\"noopener noreferrer\">Source<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;#What Is Just-In-Time (JIT) Compilation? \u2013 CloudSavvy IT&#8221; Just-In-Time compilation, or JIT, is a technique used by runtime interpreters for languages like JavaScript, C#, and Java to bring execution speeds closer to the native performance offered by precompiled binary languages like C++. Compilers vs. Interpreters Computers don\u2019t know how to execute high-level programming languages like&#8230;<\/p>\n","protected":false},"author":1,"featured_media":76095,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2020\/09\/08aed692.png","fifu_image_alt":"","footnotes":""},"categories":[18],"tags":[],"class_list":["post-76094","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology"],"_links":{"self":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/76094","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/comments?post=76094"}],"version-history":[{"count":0,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/76094\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media\/76095"}],"wp:attachment":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media?parent=76094"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/categories?post=76094"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/tags?post=76094"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}