Does the .NET CLR JIT compile every method, every time?

前端 未结 4 938
广开言路
广开言路 2020-12-01 01:25

I know that Java\'s HotSpot JIT will sometimes skip JIT compiling a method if it expects the overhead of compilation to be lower than the overhead of running the method in i

4条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-01 02:03

    I don't believe so, and I don't think that it ever should.

    How could the JIT know how many times a particular method would be called? Wouldn't the frequency of interpretation factor into the decision?

    I would also question how well a JIT compiler would be able to analyze a function to determine whether or not interpretation would be best without interpreting the function itself. And given that fact (that at least one pass of the method has taken place) wouldn't it be better to simply compile each method to reduce the overhead of trying to determine which methods get compiled in the first place?

提交回复
热议问题