标题: 基于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
显示于类别:Thesis