當前位置:首頁 » 編程軟體 » 熱編譯

熱編譯

發布時間: 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 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 瀏覽:704
移動中心怎麼配置安卓系統 發布:2024-09-21 02:27:16 瀏覽:606
安卓手機舊版app怎麼下載 發布:2024-09-21 02:12:35 瀏覽:799
方舟知道ip怎麼加入伺服器 發布:2024-09-21 02:12:14 瀏覽:791
像素工廠如何加入遠程伺服器 發布:2024-09-21 02:11:00 瀏覽:824
手機服務密碼怎麼獲取 發布:2024-09-21 02:10:55 瀏覽:253