{"id":6620,"date":"2024-11-15T11:11:59","date_gmt":"2024-11-15T03:11:59","guid":{"rendered":"https:\/\/t.n-years.com\/?p=6620"},"modified":"2024-11-15T11:11:59","modified_gmt":"2024-11-15T03:11:59","slug":"jit%ef%bc%88just-in-time%ef%bc%89%e5%92%8c-aot%ef%bc%88ahead-of-time%ef%bc%89","status":"publish","type":"post","link":"https:\/\/t.n-years.com\/?p=6620","title":{"rendered":"JIT\uff08Just-In-Time\uff09\u548c AOT\uff08Ahead-Of-Time\uff09"},"content":{"rendered":"<p>\u95ee\uff1aDart includes both a Dart VM with just-in-time (JIT) compilation and an ahead-of-time (AOT) compiler for producing machine code. \u600e\u4e48\u7406\u89e3 JIT \u548c AOT<\/p>\n<p>JIT\uff08Just-In-Time\uff09\u548c AOT\uff08Ahead-Of-Time\uff09\u662f\u4e24\u79cd\u7f16\u8bd1\u65b9\u6cd5\uff0c\u5206\u522b\u9002\u7528\u4e8e\u4e0d\u540c\u7684\u8fd0\u884c\u9700\u6c42\u548c\u573a\u666f\u3002\u5728 Dart \u4e2d\uff0c\u8fd9\u4e24\u79cd\u65b9\u5f0f\u4e5f\u90fd\u6709\u6240\u5e94\u7528\u3002\u4ee5\u4e0b\u662f\u5bf9\u5b83\u4eec\u7684\u8be6\u7ec6\u89e3\u91ca\uff1a<\/p>\n<h3>1. JIT\uff08Just-In-Time \u7f16\u8bd1\uff09<\/h3>\n<p><strong>\u6982\u5ff5<\/strong>\uff1a<br \/>\nJIT \u662f\u5728\u7a0b\u5e8f\u8fd0\u884c\u671f\u95f4\u5b9e\u65f6\u5c06\u5b57\u8282\u7801\u7f16\u8bd1\u6210\u673a\u5668\u7801\u7684\u7f16\u8bd1\u65b9\u6cd5\u3002\u8fd9\u610f\u5473\u7740\u4ee3\u7801\u5728\u6267\u884c\u7684\u8fc7\u7a0b\u4e2d\u624d\u4f1a\u8fdb\u884c\u7f16\u8bd1\uff0c\u6240\u4ee5\u7f16\u8bd1\u8fc7\u7a0b\u548c\u6267\u884c\u8fc7\u7a0b\u662f\u4ea4\u66ff\u8fdb\u884c\u7684\u3002JIT \u7f16\u8bd1\u4e00\u822c\u7528\u4e8e\u5f00\u53d1\u9636\u6bb5\uff0c\u56e0\u4e3a\u5b83\u7684\u5373\u65f6\u6027\u975e\u5e38\u9002\u5408\u9891\u7e41\u7684\u4ee3\u7801\u6539\u52a8\u548c\u8c03\u8bd5\u3002<\/p>\n<p><strong>Dart \u4e2d\u7684\u5e94\u7528<\/strong>\uff1a<\/p>\n<ul>\n<li>\u5728\u5f00\u53d1 Flutter \u5e94\u7528\u65f6\uff0cDart \u4f7f\u7528 JIT \u7f16\u8bd1\uff0c\u8fd9\u5141\u8bb8 <strong>\u70ed\u91cd\u8f7d\uff08Hot Reload\uff09<\/strong> \u529f\u80fd\uff0c\u4f7f\u5f00\u53d1\u8005\u80fd\u591f\u5b9e\u65f6\u770b\u5230\u4ee3\u7801\u66f4\u6539\u6548\u679c\uff0c\u800c\u65e0\u9700\u91cd\u65b0\u7f16\u8bd1\u6574\u4e2a\u5e94\u7528\u3002\u8fd9\u6781\u5927\u5730\u63d0\u5347\u4e86\u5f00\u53d1\u6548\u7387\u3002<\/li>\n<li>JIT \u7f16\u8bd1\u53ef\u4ee5\u5728\u8fd0\u884c\u65f6\u5206\u6790\u4ee3\u7801\u7684\u6267\u884c\u60c5\u51b5\uff0c\u4ece\u800c\u8fdb\u884c\u4e00\u4e9b\u4f18\u5316\uff0c\u63d0\u9ad8\u4ee3\u7801\u8fd0\u884c\u6548\u7387\u3002<\/li>\n<\/ul>\n<p><strong>\u4f18\u7f3a\u70b9<\/strong>\uff1a<\/p>\n<ul>\n<li><strong>\u4f18\u70b9<\/strong>\uff1a\u652f\u6301\u70ed\u91cd\u8f7d\uff0c\u4fbf\u4e8e\u8c03\u8bd5\u548c\u5f00\u53d1\uff0c\u53ef\u4ee5\u6839\u636e\u5b9e\u9645\u6267\u884c\u60c5\u51b5\u8fdb\u884c\u4f18\u5316\u3002<\/li>\n<li><strong>\u7f3a\u70b9<\/strong>\uff1a\u6bcf\u6b21\u8fd0\u884c\u65f6\u90fd\u9700\u8981\u8fdb\u884c\u7f16\u8bd1\uff0c\u56e0\u6b64\u542f\u52a8\u65f6\u95f4\u4f1a\u8f83\u957f\uff0c\u800c\u4e14\u7f16\u8bd1\u671f\u95f4\u7684\u6027\u80fd\u5f00\u9500\u8f83\u5927\u3002<\/li>\n<\/ul>\n<h3>2. AOT\uff08Ahead-Of-Time \u7f16\u8bd1\uff09<\/h3>\n<p><strong>\u6982\u5ff5<\/strong>\uff1a<br \/>\nAOT \u662f\u5728\u7a0b\u5e8f\u8fd0\u884c\u524d\u5c06\u4ee3\u7801\u7f16\u8bd1\u4e3a\u673a\u5668\u7801\uff0c\u8fd9\u6837\u5728\u5b9e\u9645\u6267\u884c\u65f6\u76f4\u63a5\u8fd0\u884c\u673a\u5668\u7801\uff0c\u65e0\u9700\u518d\u8fdb\u884c\u7f16\u8bd1\u3002\u56e0\u6b64\uff0cAOT \u7f16\u8bd1\u540e\u7684\u7a0b\u5e8f\u6027\u80fd\u901a\u5e38\u8f83\u9ad8\uff0c\u542f\u52a8\u901f\u5ea6\u4e5f\u66f4\u5feb\u3002AOT \u7f16\u8bd1\u9002\u7528\u4e8e\u9700\u8981\u9ad8\u6027\u80fd\u3001\u5feb\u901f\u542f\u52a8\u7684\u573a\u666f\uff0c\u5982\u53d1\u5e03\u5230\u751f\u4ea7\u73af\u5883\u7684\u79fb\u52a8\u5e94\u7528\u3002<\/p>\n<p><strong>Dart \u4e2d\u7684\u5e94\u7528<\/strong>\uff1a<\/p>\n<ul>\n<li>\u5728\u53d1\u5e03 Flutter \u5e94\u7528\u7684\u751f\u4ea7\u7248\u672c\u65f6\uff0cDart \u4f7f\u7528 AOT \u7f16\u8bd1\u5c06\u5e94\u7528\u7684\u4ee3\u7801\u7f16\u8bd1\u6210\u673a\u5668\u7801\uff0c\u8fd9\u6837\u5e94\u7528\u53ef\u4ee5\u5728\u8bbe\u5907\u4e0a\u9ad8\u6548\u5730\u8fd0\u884c\u3002<\/li>\n<li>iOS \u548c Android \u4e0a\u7684 Flutter \u5e94\u7528\u5728\u53d1\u5e03\u65f6\u90fd\u4f7f\u7528 AOT \u7f16\u8bd1\uff0c\u786e\u4fdd\u4e86\u66f4\u597d\u7684\u8fd0\u884c\u901f\u5ea6\u548c\u8f83\u5c0f\u7684\u5185\u5b58\u5360\u7528\u3002<\/li>\n<\/ul>\n<p><strong>\u4f18\u7f3a\u70b9<\/strong>\uff1a<\/p>\n<ul>\n<li><strong>\u4f18\u70b9<\/strong>\uff1a\u542f\u52a8\u901f\u5ea6\u66f4\u5feb\uff0c\u8fd0\u884c\u65f6\u4e0d\u9700\u8981\u7f16\u8bd1\uff0c\u56e0\u6b64\u6027\u80fd\u66f4\u597d\uff0c\u9002\u5408\u751f\u4ea7\u73af\u5883\u3002<\/li>\n<li><strong>\u7f3a\u70b9<\/strong>\uff1a\u7f16\u8bd1\u65f6\u95f4\u8f83\u957f\uff0c\u4e14\u7f16\u8bd1\u540e\u751f\u6210\u7684\u673a\u5668\u7801\u4f53\u79ef\u901a\u5e38\u8f83\u5927\uff0c\u4e0d\u652f\u6301\u70ed\u91cd\u8f7d\u3002<\/li>\n<\/ul>\n<h3>\u603b\u7ed3<\/h3>\n<ul>\n<li><strong>JIT<\/strong> \u66f4\u9002\u5408\u5f00\u53d1\u9636\u6bb5\uff0c\u4fbf\u4e8e\u8c03\u8bd5\u548c\u5b9e\u65f6\u66f4\u6539\u4ee3\u7801\u3002Dart VM \u7684 JIT \u7f16\u8bd1\u4f7f\u5f97 Flutter \u53ef\u4ee5\u5728\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u652f\u6301\u70ed\u91cd\u8f7d\u3002<\/li>\n<li><strong>AOT<\/strong> \u66f4\u9002\u5408\u751f\u4ea7\u9636\u6bb5\uff0c\u4f18\u5316\u4e86\u6027\u80fd\u548c\u542f\u52a8\u901f\u5ea6\u3002Flutter \u5e94\u7528\u5728\u53d1\u5e03\u65f6\u4f1a\u4f7f\u7528 AOT \u7f16\u8bd1\uff0c\u63d0\u9ad8\u4e86\u6700\u7ec8\u7528\u6237\u7684\u4f53\u9a8c\u3002<\/li>\n<\/ul>\n<p>\u5728 Flutter \u4e2d\uff0cDart \u4f7f\u7528 JIT \u7f16\u8bd1\u6765\u652f\u6301\u5f00\u53d1\u65f6\u7684\u5feb\u901f\u8fed\u4ee3\uff0c\u800c\u5728\u53d1\u5e03\u9636\u6bb5\u5219\u4f7f\u7528 AOT \u7f16\u8bd1\u4ee5\u4fdd\u8bc1\u6700\u7ec8\u4ea7\u54c1\u7684\u9ad8\u6027\u80fd\u548c\u7a33\u5b9a\u6027\u3002<\/p>\n<p><a href=\"https:\/\/dart.dev\/overview\">https:\/\/dart.dev\/overview<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u95ee\uff1aDart includes both a Dart VM with just-in-time (JIT) &#8230; <\/p>\n<div class=\"read-more navbutton\"><a href=\"https:\/\/t.n-years.com\/?p=6620\">\u9605\u8bfb\u66f4\u591a<i class=\"fa fa-angle-double-right\"><\/i><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[135],"tags":[],"class_list":["post-6620","post","type-post","status-publish","format-standard","hentry","category-135"],"_links":{"self":[{"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/posts\/6620","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/t.n-years.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6620"}],"version-history":[{"count":1,"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/posts\/6620\/revisions"}],"predecessor-version":[{"id":6621,"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/posts\/6620\/revisions\/6621"}],"wp:attachment":[{"href":"https:\/\/t.n-years.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6620"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/t.n-years.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6620"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/t.n-years.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6620"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}