当前位置:网站首页>JVM: 设置代码执行模式(解释模式、编译模式、混合模式)
JVM: 设置代码执行模式(解释模式、编译模式、混合模式)
2022-08-06 03:33:00 【amadeus_liu2】
HotSpot虚拟机默认执行模式为混合模式:即解释执行和热点代码编译执行,
相当于默认设置了如下参数:
-Xmixed
可以分别用如下方式设置编译模式和解释模式:
-Xcomp
-Xint
可以使用如下例子来对比不同模式下的代码执行时间
package cn.edu.tju;
public class JitTest {
public static void main(String[] args) {
long start=System.currentTimeMillis();
for(int i=0;i<100_0000;i++){
myFunction();
}
long end = System.currentTimeMillis();
System.out.println(end-start);
start=System.currentTimeMillis();
for(int i=0;i<100_0000;i++){
myFunction();
}
end = System.currentTimeMillis();
System.out.println(end-start);
}
public static void myFunction(){
for(int i=0;i<10000;i++){
for(int j=0;j<10000;j++){
for(int k=0;k<10000;k++){
}
}
}
}
}
边栏推荐
- C Student Management System Print/Modify Designated Location Information
- 2022年企业和站长租用服务器的几个常见误区
- 2022年天猫七夕价格便宜吗?天猫七夕节有什么优惠?
- 【Translation】Serverless Architecture: Pros and Cons
- leetcode 15. Sum of three numbers
- 谷歌分析中的转化目标设置后,大概多久能显示在Google adwords后台?
- 【翻译】无服务器架构:利与弊
- Entering the pit of machine learning: 2. Supervised learning
- Web3.exceptions.ExtraDataLengthError
- Mysql installation ask for answers
猜你喜欢

【无标题】

Qixi Festival WeChat confession wall applet source code / Laravel-based confession wall WeChat applet source code

喜欢我们不如加入我们:来投稿吧,稿酬靠谱!

xctf attack and defense world web master advanced area command_execution

Sorting out the knowledge system of fully homomorphic encryption

2022年天猫8月份有什么大的活动?

FluentValidation

【LaTex】 - 对齐符号&的用法,换行符\\的用法,Misplaced &错误怎么解决

Introduction to Elliptic Curves (4): Elliptic Curve Security, Compared with RSA

What is an Egg. The js, it have what features, installation of an Egg framework, definition of routing, what's Controller is the Controller, CORS configuration, the json configuration, a get request,
随机推荐
What are the highlights of the 2022 Jingdong New Department Store Qixi Festival Promotion Season?
Lvm根分区扩容
After the conversion goal in Google Analytics is set, how long does it take to display in the Google adwords backend?
2022年天猫8月份有什么大的活动?
ALV details are reorganized2022.8.5
The first day of learning MySQL: MySQL overview (basic)
【Translation】Serverless Architecture: Pros and Cons
个推数据智能技术实践 | 教你打造数据质量心电图,智能检测数据“心跳”异常
Questions about the control class of electric games
leetcode:20. Valid parentheses
xctf攻防世界 Web高手进阶区 easytornado
Introduction to Elliptic Curves (4): Elliptic Curve Security, Compared with RSA
C Student management system Delete the specified student node (general situation)
A complete solution for serial port data reception in QT
What is an inner class?
2022 Alibaba Cloud server configuration selection strategy
R语言ggplot2循环中保存图片失败问题
NetCore - custom exception handling
什么浏览器广告少?多御安全浏览器轻体验
The delivery language set in the Google Ads background, if English is set, does it mean that the user is using English?