What are the advantages of just-in-time compilation versus ahead-of-time compilation?

前端 未结 9 2306
挽巷
挽巷 2020-12-02 05:56

I\'ve been thinking about it lately, and it seems to me that most advantages given to JIT compilation should more or less be attributed to the intermediate

9条回答
  •  长情又很酷
    2020-12-02 06:33

    One advantage of JIT which I don't see listed here is the ability to inline/optimize across separate assemblies/dlls/jars (for simplicity I'm just going to use "assemblies" from here on out).

    If your application references assemblies which might change after install (e. g. pre-installed libraries, framework libraries, plugins), then a "compile-on-install" model must refrain from inlining methods across assembly boundaries. Otherwise, when the referenced assembly is updated we would have to find all such inlined bits of code in referencing assemblies on the system and replace them with the updated code.

    In a JIT model, we can freely inline across assemblies because we only care about generating valid machine code for a single run during which the underlying code isn't changing.

提交回复
热议问题