当前位置:首页 » 编程软件 » 热编译

热编译

发布时间: 2022-01-09 11:49:59

java 编译优化问题

java编译的结果是字节码而不是二进制,所以在运行时vm的优化才是重要的,包括VM的回收策略、分配给VM内存的大小都能在一定程度上影响性能。Sun的VM支持热点编译,对高频执行的代码段翻译的2进制会进行缓存,这也是VM的一种优化。

IBM JVM处理数学运算速度最快,BEA JVM处理大量线程和网络socket性能最好,而Sun JVM处理通常的商业逻辑性能最好。不过Hotspot的Server mode被报告有稳定性的问题。

Java 的最大优势不是体现在执行速度上,所以对Compiler的要求并不如c++那样高,代码级的优化还需要程序员本身的功底。

贴个java的运行参数:

Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)

where options include:
-client to select the "client" VM
-server to select the "server" VM
-hotspot is a synonym for the "client" VM [deprecated]
The default VM is client.

-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A ; separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose[:class|gc|jni]
enable verbose output
-version print proct version and exit
-version:<value>
require the specified version to run
-showversion print proct version and continue
-jre-restrict-search | -jre-no-restrict-search
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see

java.lang.instrument

-Xmixed mixed mode execution (default)
-Xint interpreted mode execution only
-Xbootclasspath:<directories and zip/jar files separated by ;>
set search path for bootstrap classes and resources
-Xbootclasspath/a:<directories and zip/jar files separated by ;>
append to end of bootstrap class path
-Xbootclasspath/p:<directories and zip/jar files separated by ;>
prepend in front of bootstrap class path
-Xnoclassgc disable class garbage collection
-Xincgc enable incremental garbage collection
-Xloggc:<file> log GC status to a file with time stamps
-Xbatch disable background compilation
-Xms<size> set initial Java heap size
-Xmx<size> set maximum Java heap size
-Xss<size> set java thread stack size
-Xprof output cpu profiling data
-Xfuture enable strictest checks, anticipating future default
-Xrs rece use of OS signals by Java/VM (see

documentation)
-Xcheck:jni perform additional checks for JNI functions
-Xshare:off do not attempt to use shared class data
-Xshare:auto use shared class data if possible (default)
-Xshare:on require using shared class data, otherwise fail.

Java虚拟机(JVM)参数配置说明

在Java、J2EE大型应用中,JVM非标准参数的配置直接关系到整个系统的性能。
JVM非标准参数指的是JVM底层的一些配置参数,这些参数在一般开发中默认即可,不需

要任何配置。但是在生产环境中,为了提高性能,往往需要调整这些参数,以求系统达

到最佳新能。
另外这些参数的配置也是影响系统稳定性的一个重要因素,相信大多数Java开发人员都

见过“OutOfMemory”类型的错误。呵呵,这其中很可能就是JVM参数配置不当或者就没

有配置没意识到配置引起的。

为了说明这些参数,还需要说说JDK中的命令行工具一些知识做铺垫。

首先看如何获取这些命令配置信息说明:
假设你是windows平台,你安装了J2SDK,那么现在你从cmd控制台窗口进入J2SDK安装目

录下的bin目录,然后运行java命令,出现如下结果,这些就是包括java.exe工具的和

JVM的所有命令都在里面。

-----------------------------------------------------------------------
D:\j2sdk15\bin>java
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)

where options include:
-client to select the "client" VM
-server to select the "server" VM
-hotspot is a synonym for the "client" VM [deprecated]
The default VM is client.

-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A ; separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose[:class|gc|jni]
enable verbose output
-version print proct version and exit
-version:<value>
require the specified version to run
-showversion print proct version and continue
-jre-restrict-search | -jre-no-restrict-search
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see

java.lang.instrument
-----------------------------------------------------------------------
在控制台输出信息中,有个-X(注意是大写)的命令,这个正是查看JVM配置参数的命

令。

其次,用java -X 命令查看JVM的配置说明:
运行后如下结果,这些就是配置JVM参数的秘密武器,这些信息都是英文的,为了方便

阅读,我根据自己的理解翻译成中文了(不准确的地方还请各位博友斧正)
-----------------------------------------------------------------------
D:\j2sdk15\bin>java -X
-Xmixed mixed mode execution (default)
-Xint interpreted mode execution only
-Xbootclasspath:<directories and zip/jar files separated by ;>
set search path for bootstrap classes and resources
-Xbootclasspath/a:<directories and zip/jar files separated by ;>
append to end of bootstrap class path
-Xbootclasspath/p:<directories and zip/jar files separated by ;>
prepend in front of bootstrap class path
-Xnoclassgc disable class garbage collection
-Xincgc enable incremental garbage collection
-Xloggc:<file> log GC status to a file with time stamps
-Xbatch disable background compilation
-Xms<size> set initial Java heap size
-Xmx<size> set maximum Java heap size
-Xss<size> set java thread stack size
-Xprof output cpu profiling data
-Xfuture enable strictest checks, anticipating future default
-Xrs rece use of OS signals by Java/VM (see

documentation)
-Xcheck:jni perform additional checks for JNI functions
-Xshare:off do not attempt to use shared class data
-Xshare:auto use shared class data if possible (default)
-Xshare:on require using shared class data, otherwise fail.

The -X options are non-standard and subject to change without notice.
-----------------------------------------------------------------------

JVM配置参数中文说明:
-----------------------------------------------------------------------
1、-Xmixed mixed mode execution (default)
混合模式执行

2、-Xint interpreted mode execution only
解释模式执行

3、-Xbootclasspath:<directories and zip/jar files separated by ;>
set search path for bootstrap classes and resources
设置zip/jar资源或者类(.class文件)存放目录路径

3、-Xbootclasspath/a:<directories and zip/jar files separated by ;>
append to end of bootstrap class path
追加zip/jar资源或者类(.class文件)存放目录路径

4、-Xbootclasspath/p:<directories and zip/jar files separated by ;>
prepend in front of bootstrap class path
预先加载zip/jar资源或者类(.class文件)存放目录路径

5、-Xnoclassgc disable class garbage collection
关闭类垃圾回收功能

6、-Xincgc enable incremental garbage collection
开启类的垃圾回收功能

7、-Xloggc:<file> log GC status to a file with time stamps
记录垃圾回日志到一个文件。

8、-Xbatch disable background compilation
关闭后台编译

9、-Xms<size> set initial Java heap size
设置JVM初始化堆内存大小

10、-Xmx<size> set maximum Java heap size
设置JVM最大的堆内存大小

11、-Xss<size> set java thread stack size
设置JVM栈内存大小

12、-Xprof output cpu profiling data
输入CPU概要表数据

13、-Xfuture enable strictest checks, anticipating future default
执行严格的代码检查,预测可能出现的情况

14、-Xrs rece use of OS signals by Java/VM (see

documentation)
通过JVM还原操作系统信号

15、-Xcheck:jni perform additional checks for JNI functions
对JNI函数执行检查

16、-Xshare:off do not attempt to use shared class data
尽可能不去使用共享类的数据

17、-Xshare:auto use shared class data if possible (default)
尽可能的使用共享类的数据

18、-Xshare:on require using shared class data, otherwise fail.
尽可能的使用共享类的数据,否则运行失败

The -X options are non-standard and subject to change without notice.

⑵ Go语言做Web应用开发的框架,哪一个更适合入门

  • Revel Web开源框架

    个高效的Go语言Web开发框架,其思路完全来自 Java 的Play Framework。

  • 特点

    热编译,简单可选,同步(每个请求都创建自己的goroutine来处理。

  • Go语言Web框架:beego

    一个用Go开发的应用框架,思路来自于tornado,路由设计来源于sinatra。

  • 支持特性

  1. MVC;

  2. REST;

  3. 智能路由;

  4. 日志调试;

  5. 配置管理;

  6. 模板自动渲染;

  7. layout设计;

  8. 中间件插入逻辑;

  9. 方便的JSON/XML服务;

⑶ golang有没有好的开源游戏框架

1.为什么golang的开发效率高? golang是一编译型的强类型语言,它在开发上的高效率主要来自于后发优势,不用考虑旧有恶心的历史,又有一个较高的工程视角。

⑷ Go语言做Web应用开发的框架,哪一个更适合入门

  • Revel Web开源框架

    个高效的Go语言Web开发框架,其思路完全来自 Java 的Play Framework。

  • 特点

    热编译,简单可选,同步(每个请求都创建自己的goroutine来处理。

  • Go语言Web框架:beego

    一个用Go开发的应用框架,思路来自于tornado,路由设计来源于sinatra。

  • 支持特性

  • MVC;

  • REST;

  • 智能路由;

  • 日志调试;

  • 配置管理;

  • 模板自动渲染;

  • layout设计;

  • 中间件插入逻辑;

  • 方便的JSON/XML服务;

⑸ 开发的时候用什么工具做热编译

node.js 其实本质上就是 javascript。至于开发 javascript的工具, IDE的话,我觉得 eclipse 就可以了。文本编辑器的话,editplus或者notepad++都可以

⑹ 热编译只有在debug模式下吗

1、你是用于调试 可以用 如下宏来处理代码

1
2
3
4
5

#ifdef DEBUG
//do sth.
#else
//do sth.
#endif

2、如果是要玩花活 可以使用下面的代码,下面的代码在vc6.0中测试通过,你生成debug版,它会打印debug mode,你生成release 它会打印 release mode;

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

#include <stdio.h>
class is_debug{
public:
is_debug(int v) { a = v;}
int a;
};
int main()
{
unsigned this_addr;
is_debug o_o(2);
__asm mov dword ptr this_addr,eax
if ((unsigned)(&o_o)==this_addr) printf("this is debug mode!\n");
else printf("this is release mode\n");
return 0;
}

⑺ java编译器的代码优化问题

理论上的就不说了,你自己搜也能搜到很多。
举个例子,你从一个方法a调用了另一个方法b。
我们知道,在a和b之中是可以创建相同名称的变量的,比如都有int i = 0;这句话。这种现象的根本原因在于,方法的调用会产生中断,中断产生后,cpu会做现场保护,包括把变量等进行压栈操作,即把方法a的相关资源进行了压栈,而方法b的相关资源放在栈顶,只有栈顶资源可以与cpu交互(就把方法a中的变量i保护起来),当方法b结束后出栈,a就又回到了栈顶,并获取了方法b运行的结果,然后继续运行。

哎,有些啰嗦了。方法的调用、中断、压栈出栈等等这些操作你说一点不消耗资源吧,那是不可能的,多少都会消耗一些,虽然很非常十分微不足道。那么编译器的优化过程,我知道的其作用之一,就是会把这些做一个优化。原本方法a一共10句话,你偏要只写1句,然后第2句写成方法b,第3句写成方法c。。。。。,然后依次嵌套调用。这样的源代码,编译器优化后,就跟你直接写10句是一个结果,即做了一定程度上的优化。

⑻ react+webpack的热编译问题

devServer没有配 loaders里的react-hot也没配 看下官方文档去吧

⑼ maven有没有热编译插件

尝试下:
iint[] a=new int[10]; //定义数据长度
Random r = new Random();
for (int i = 0; i < 10; i++)
{
int temp=r.Next(0,11);//0--10的随机数
a[i]=temp;//把产生的随机数付给数组
textBox1.Text=temp.ToString();
richText1.AppendText(temp.ToString()); //添加到窗体中
}

⑽ intellij idea支持热编译么

用 JRebel 插件吧,debug的时候改几行代码make一下就热更新了,非常爽,不足的是不支持新增类,新增方法。想想可以边调试边修改,就应该把持不住了吧~

热点内容
无权限访问工作组的计算机 发布:2024-09-21 04:26:31 浏览:475
为什么ipad需要密码解锁 发布:2024-09-21 04:06:22 浏览:210
mariadb存储过程 发布:2024-09-21 03:56:05 浏览:514
压缩壳脱壳机 发布:2024-09-21 03:14:33 浏览:93
热血街篮为什么是服务器维护中 发布:2024-09-21 03:08:19 浏览:937
喇叭怎么配置功放 发布:2024-09-21 03:06:50 浏览:751
为什么安卓的内存没有苹果的内存 发布:2024-09-21 03:06:50 浏览:231
swift解压 发布:2024-09-21 02:31:47 浏览:706
移动中心怎么配置安卓系统 发布:2024-09-21 02:27:16 浏览:607
安卓手机旧版app怎么下载 发布:2024-09-21 02:12:35 浏览:800