㈠ 應用編譯優化有什麼用
應用編譯優化的作用是:提高運行能力因為程序優化前,有3個變數需要3個寄存器,一次乘法運算。程序優化後,只有1個變數需要一個寄存器,沒有乘法運算。
並且這個優化看起來很微不足道,但實際上用途很廣。為了程序的可讀性和可維護性,大多數程序員應該還是會選用第一種方式。
寫3行程序而不是直接甩下一行int ticks = 491520讓後來讀程序的人摸不到頭腦。有了編譯器的優化,程序員既可以寫出易讀的程序又不必擔心性能受影響。
尤其是在嵌入式領域,很多低端晶元根本就沒有硬體乘法器,如果程序不做上述優化可能這3行代碼需要幾十個cycle,優化過後一個cycle就搞定。
應用編譯優化的級別:
第一級:代碼調整。
代碼調整是一種局部的思維方式;基本上不觸及演算法層級;它面向的是代碼,而不是問題; 所以:語句調整,用匯編重寫、指令調整、換一種語言實現、換一個編譯器、循環展開、參數傳遞優化等都屬於這一級。
第二級:新的視角。
新的視角強調的重點是針對問題的演算法;即選擇和構造適合於問題的演算法。
第三級:表驅動狀態機。
將問題抽象為另一種等價的數學模型或假想機器模型,比如構造出某種表驅動狀態機;這一級其實是第二級的延伸,只是產生的效果更加明顯,但它有其本身的特點。
㈡ 編譯器 優化
編譯是從源代碼(通常為高階語言)到能直接被計算機或虛擬機執行的目標代碼(通常為低階語言或機器語言)的翻譯過程。然而,也存在從低階語言到高階語言的編譯器,這類編譯器中用來從由高階語言生成的低階語言代碼重新生成高階語言代碼的又被叫做反編譯器。也有從一種高階語言生成另一種高階語言的編譯器,或者生成一種需要進一步處理的的中間代碼的編譯器(又叫級聯)。
典型的編譯器輸出是由包含入口點的名字和地址, 以及外部調用(到不在這個目標文件中的函數調用)的機器代碼所組成的目標文件。一組目標文件,不必是同一編譯器產生,但使用的編譯器必需採用同樣的輸出格式,可以鏈接在一起並生成可以由用戶直接執行的可執行程序。
從他的原理我們就好優化了,但是方法很多的
㈢ 應用編譯優化哪個模式好
即時編譯技術。
JIT為「即時編譯技術」,當App運行時,每當遇到一個新類,JIT編譯器就會對這個類進行編譯,經過編譯後的代碼,會被優化成相當精簡的原生型指令碼(即nativecode),這樣在下次執行到相同邏輯的時候,速度就會更快。
㈣ 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.
㈤ 清濁應用編譯優化怎麼用
清濁是一個有點實用的清理類app,下載後點擊三角鍵即可開始清理。
因為在我的日常清理中我需要自定義目錄的清理,所以寫了這么一個app,當然實用性也很強,可以通過載入任務完成所需要的清理,一些基本功能像空目錄清理、卸載殘留清理也包含在內了。
伺服器為大家提供了基本的清理任務,可以自行載入,當然清濁目前還是第一個版本難免有一些問題什麼的,以後會有越來越多的規則加入,功能也會越來越豐富呢,快來試試吧。
2021.10.07 v1.7.7版本更新說明:
1、幹掉文件夾,安卓11可以訪問【android/data】並幹掉其中的文件夾、
2、排除項加了個排除應用的功能,只排除應用清理的時候哦。其他時候不排除,,注意,長按按鈕可以展開按鈕然後添加應用。
3、應用編譯改了下,上個版本沒加長按全部編譯。
4、文件大小分析安卓11【android/data】不能進去的問題搞定。
5、文件分類分析,刪除文件閃退問題。
6、選擇項的選擇框,加大了一點范圍。
7、應用凍結,選擇應用不再排除已經凍結的應用,因為出現了,暫時不知道原因的,凍結列表丟失的問題,暫時沒找到原因。
8、一些像隱私政策文本顯示不能滑動出錯的問題
9、其他閃退的問題,列表點擊閃退的問題。
㈥ 安卓手機怎麼設置 手機系統設置 手機性能才能提到最高
可以通過開啟發者選項,並對開發者選項相關項進行優化設置,提高手機的流暢性。
(以小米手機為例)MIUI有很多的這樣的功能,具體是菜單跳轉的漸進漸出,窗口關閉與打開時的過渡效果等,雖然過渡的不是很慢,這個功能是在開發者選項裡面設置,默認MIUI是隱藏了開發者選項的,如何開啟開發者選項以及如何設置過渡動畫可以按以下教程:
1、在手機主屏找到設置->關於手機。
5、如果將上面的效果設置為2,再返回去操作就會發現,比如打開設置,再點開其它菜單就會顯得慢,會有漸入的感覺,讓人覺得不能忍受,改到0.5或者關閉就快多了,直接彈出下一級菜單。
㈦ 如何反編譯android應用以及重編譯,簽名和對齊優化
工具/原料
電腦必須裝JAVA
JAVA電腦環境教程
apktool
方法/步驟
1. 配置好JAVA環境變數,下載:apktool 解壓的文件放在C盤根目錄的apktool文件夾里(apktool文件夾自己創立)
打開命令提示符,(開始-運行-輸入cmd)
2. 輸入:cd \apktool 系統指令到了apktool文件夾(這里就是為什麼要把解壓的apktool解壓的文件放到apktool文件夾的原因,當然你也可以自命名文件夾的名稱,那麼比如arc,那麼指令就變成了:cd \arc 前提是你必須把apktool解壓的文件放到這個文件夾裡面)
3. 使用RE管理器把系統裡面的framework-res.apk 與 SystemUI.apk 提取出來放在apktool文件夾裡面
4. 如果只是想反編譯framework-res.apk
輸入apktool if framework-res.apk(框架的建立)
5. 開始最重要的反編譯,輸入指令,apktool d framework-res.apk
(反編輯的APK一定要用沒換過圖片的,否則回編輯失敗)
6. 最後反編譯完成
7. 修改代碼完成後,輸入代碼:apktool d framework-res 即可完成回編譯
8. 如果反編譯的是系統文件,比如,SystemUI.apk 那麼必須進行掛載框架,反編譯時,必須敲入一下命令:(然後再重復4-7步驟)
apktool if framework-res.apk
apktool if SystemUI.apk
9. 對於三星手機(比如9100、9108/9100G),如果反編譯SystemUI.apk要敲入一下命令進行框架掛載apktool if framework-res.apk
apktool if twframework-res.apk
apktool if SystemUI.apk
10. 回編譯的命令是 apktool b XXX (沒有後面的apk後綴)反編譯的命令是 apktool d xxx (有後面的apk)
㈧ 編譯器的編譯器優化
應用程序之所以復雜, 是由於它們具有處理多種問題以及相關數據集的能力。實際上, 一個復雜的應用程序就象許多不同功能的應用程序「 粘貼」 在一起。源文件中大部分復雜性來自於處理初始化和問題設置代碼。這些文件雖然通常占源文件的很大一部分, 具有很大難度, 但基本上不花費C PU 執行周期。
盡管存在上述情況, 大多數Makefile文件只有一套編譯器選項來編譯項目中所有的文件。因此, 標準的優化方法只是簡單地提升優化選項的強度, 一般從O 2 到O 3。這樣一來, 就需要投人大量 精力來調試, 以確定哪些文件不能被優化, 並為這些文件建立特殊的make規則。
一個更簡單但更有效的方法是通過一個性能分析器, 來運行最初的代碼, 為那些佔用了85 一95 % CPU 的源文件生成一個列表。通常情況下, 這些文件大約只佔所有文件的1%。如果開發人員立刻為每一個列表中的文件建立其各自的規則, 則會處於更靈活有效的位置。這樣一來改變優化只會引起一小部分文件被重新編譯。進而,由於時間不會浪費在優化不費時的函數上, 重編譯全部文件將會大大地加快。
㈨ 的編譯優化功能:有沒有部分不優化的方法,該如何處理
keil-project-options for target-選項卡c/c++ 左側中間有個optimization 後面的對應的就是編譯優化設置level 0就是不優化