How to check if the JIT compiler is off in Java(如何检查 JIT 编译器是否在 Java 中关闭)
问题描述
我想知道如何检查 JIT 编译器是否已关闭.我有以下代码,旨在关闭 JIT 编译器.问题是,我不确定它是否真的这样做.所以我想知道是否有办法检查 JIT 是否关闭.我查看了 Compiler 类,但没有像 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 程序进行基准测试,您绝对应该忽略前几次运行.在 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.
这篇关于如何检查 JIT 编译器是否在 Java 中关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何检查 JIT 编译器是否在 Java 中关闭
基础教程推荐
- 将 double 转换为 Int,向下舍入 2022-01-01
- doFilter()是在servlet的工作完成之前还是之后执行的? 2022-01-01
- 控制台应用程序中的 Java 键盘输入解析 2022-01-01
- 将 Windows 证书导入 Java 2022-01-01
- 在java中使用xpath和selenium解析HTML表格数据 2022-01-01
- Java ECDSAwithSHA256 签名长度不一致 2022-01-01
- 如何在相机中应用自定义滤镜 [Surfaceview 预览]. 2022-01-01
- JPA惰性列表上的流 2022-01-01
- Maven:无效的目标版本:10 2022-01-01
- 在springboot中如何给mybatis加拦截器 2023-04-29
