如何检查Java中的JIT编译器是否关闭

编程入门 行业动态 更新时间:2024-10-28 05:28:46
本文介绍了如何检查Java中的JIT编译器是否关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想知道如何检查JIT编译器是否关闭。我有以下代码,这意味着关闭JIT编译器。问题是,我不知道如果它是真的这样做。所以我想知道是否有一种方法来检查JIT是否关闭。 我查看了编译器类,但没有任何方法 isDisabled / enabled()。

I would like to know how to check if the JIT compiler is turned off. I have the following code which is meant to turn the JIT compiler off.The problem is, I am not sure if it is actually doing that. So I was wondering if there is a way of checking if the JIT is off. I looked at the Compiler class but there isn't any method like isDisabled/enabled().

代码:

Compiler.disable();

任何帮助或指导将非常感激。

Any help or direction will be highly appreciated.

推荐答案

我不相信你可以在运行时关闭JIT。

I don't believe you can turn the JIT off at runtime.

程序,你肯定会忽略前几个运行。在Java中获得可靠的基准测试是一个非常棘手的事情,最好留给比你或我更聪明的人。

If you want to seriously benchmark a Java program, you should definitely be ignoring the first few runs. Getting reliable benchmarks in Java is an extremely tricky business, best left to people much smarter than you or I.

我建议使用 Caliper ,它在Google内部用于微基准测试,并且对于预热JIT和其他东西非常有用。具体来说,查看此处的示例,其中显示了如何衡量不同输入大小的算法的效率。

I recommend using Caliper, which is used internally at Google for microbenchmarking and is plenty smart about warming up the JIT and stuff. In particular, look at the example here, which shows how to measure the efficiency of an algorithm for different input sizes.

更多推荐

如何检查Java中的JIT编译器是否关闭

本文发布于:2023-11-07 09:13:55,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1566066.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:编译器   Java   JIT

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!