標題: 基於Emscripten產生的Asm.js程式的載入時間減少
Loading Time Reduction for Emscripten-Generated Asm.js Programs
作者: 李炳謀
游逸平
Li, Bing-Mou
You, Yi-Ping
資訊科學與工程研究所
關鍵字: JavaScript;asm.js;極簡化;重複使用;JavaScript;asm.js;Minification;library reusing
公開日期: 2016
摘要: JavaScript是一種腳本式的物件導向程式語言。在網頁應用蓬勃發展的現在,JavaScript更是被廣泛的使用。尤其近年來,使用JavaScript開發的專案是越來越複雜了。因此,就有了asm.js這個規格被提了出來。asm.js是一種以JavaScript為底所設計出來的語言,因此它可直接執行在現有的瀏覽器上面。但跟原本的JavaScript不同,asm.js在執行上更有效率。為了產生asm.js,目前廣泛被使用的工具是Emscripten,它可以將LLVM轉換成asm.js,透過它目前已經可以將C/C++、JavaScript、Python等轉換成asm.js程式了。但是Emscripten產生出來的asm.js程式有個大問題,就是它的檔案會比直接以JavaScript來開發要大的許多,這樣就算執行效能有了提升,但下載檔案時,會有使用者經驗較差的問題。因此,有必要去改善這個下載時間過長問題。 本篇論文我們提出了兩種方式解決這個問題,分別為減少asm.js的minifier跟asm.js函示的再利用。 前者,我們提出ASMJSMini來解決這個問題,它減少了程式碼的大小,並且在優化後的程式符合了asm.js所訂定的規範。後者我們實作了Library extractor與Dynamic loading。使用者透過了Library extractor將asm.js程式中可以被重複使用的程式抽取出來後,再透過Dynamic loading將函示存在瀏覽器本地端,而之後的程式將同樣透過Dynamic loading直接從本地端將函示給讀取出來,這樣將有更小的程式使用。 最後,我們實做了ASMJSMini,並且透過實驗發現,我們的ASMJSMini可以減少平均50%的asm.js程式碼大小。而在另一個Library extractor與Dynamic loading也顯示整個下載時間,有著平均49%的減少。
JavaScript is the primary programming language for web applications and has been used in many popular web applications. In recent years, some web applications are getting more complex. Therefore, asm.js, which is a subset of JavaScript, is designed to enable the performance improvements for those web applications. However, asm.js programs have a problem of larger code size than JavaScript programs, which counteracts the benefit from the reduced execution time. Therefore, reducing loading time of asm.js programs is an important matter. In this thesis, we propose ASMJSMini, an asm.js minifier, to reduce the code size of asm.js programs that the optimized asm.js programs are meeting asm.js specification. We propose library extractor and dynamic loading to reuse the same library to reduce the download time. The experimental results show that ASMJSMini had a 50% reduction in code size and the dynamic loading approach had a 49% reduction in download time of asm.js programs.
URI: http://etd.lib.nctu.edu.tw/cdrfb3/record/nctu/#GT070256076
http://hdl.handle.net/11536/143177
顯示於類別:畢業論文