温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,汇文网负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。
网站客服:3074922707
深入浅出
WebAssembly
内 容 简 介 WebAssembly 是一种新的二进制格式,它可以方便地将 C/C+等静态语言的代码快速地“运行”在浏览器中,这一特性为前端密集计算场景提供了无限可能。不仅如此,通过 WebAssembly 技术,我们还可以将基于 Unity 等游戏引擎开发的大型游戏快速地移植到 Web 端。WebAssembly 技术现在已经被计划设计成 W3C 的标准,众多浏览器厂商已经提供了对其 MVP 版本标准的支持。在 Google I/O 2017 大会上,Google首次针对WebAssembly技术进行了公开演讲和推广,其Post-MVP版本标准更是对诸如DOM操作、多线程和 GC 等特性提供了支持。WebAssembly 所带来的 Web 技术变革势不可挡。本书力求从一些简单的实践入手,深入理论,到复杂的具有实际业务价值的综合实践,深入浅出地介绍 Wasm 技术发展至今,其背后所涉及的各种底层设计原理与实现、相关工具链以及未来发展方向等多方面内容。本书内容包括:WebAssembly 技术的发展历程,从 PNaCl 到 ASM.js 再到 WebAssembly,以及这些技术的基本应用方法与性能对比;WebAssembly 的标准上层 API、底层堆栈机的设计原理,以及对MVP 标准理论的深入解读;与 WebAssembly 标准相关的进阶内容,如单指令多数据流(SIMD)、动态链接(DL)等;LLVM 工具链与 WAT 可读文本格式的相关内容;基于 Emscripten 工具链开发 WebAssembly应用的基本流程,以及工具链的一些基本常用功能和特性;基于 Emscripten 工具链实现 C/C+语言动态关系绑定技术;Emscripten 工具链所提供的一些如 WebGL 支持、虚拟文件系统、应用优化以及 HTML 5 事件系统等高级应用特性;构建一个具有实际业务价值的 WebAssembly 应用,现阶段 Wasm 生态的发展情况,以及在 Post-MVP 标准中制订的一些 WebAssembly 未来发展规划。本书的目标读者为 Web 前端开发人员、C/C+开发人员和对 WebAssembly 技术感兴趣的人员。未经许可,不得以任何方式复制或抄袭本书之部分或全部内容。版权所有,侵权必究。图书在版编目(CIP)数据 深入浅出 WebAssembly于航著.北京:电子工业出版社,2018.12 ISBN 978-7-121-35217-1 .深 .于 .编译软件 .TP314 中国版本图书馆 CIP 数据核字(2018)第 238873 号 策划编辑:张春雨 责任编辑:葛 娜 印 刷:三河市双峰印刷装订有限公司 装 订:三河市双峰印刷装订有限公司 出版发行:电子工业出版社 北京市海淀区万寿路 173 信箱 邮编:100036 开 本:787980 1/16 印张:34.25 字数:741 千字 版 次:2018 年 12 月第 1 版 印 次:2018 年 12 月第 1 次印刷 定 价:128.00 元 凡所购买电子工业出版社图书有缺损问题,请向购买书店调换。若书店售缺,请与本社发行部联系,联系及邮购电话:(010)88254888,88258888。质量投诉请发邮件至 ,盗版侵权举报请发邮件至 。本书咨询联系方式:(010)51260888-819,。序言(一)Im very excited to see this book,which covers in great detail a wide range of topics regarding WebAssembly.At this point in time WebAssembly is around one year old-if we count from when it shipped in all major browsers-so its still fairly young,and the industry is just starting to figure out how revolutionary it is going to be.The potential is there for huge impact,and good documentation is necessary for that.Why is WebAssemblys potential impact so large?For several reasons:?WebAssembly helps make the Web fast:WebAssembly is designed for small download size,fast startup,and predictably fast execution.The improvement compared to JavaScript can be very significant,over 2x in many cases,and especially in startup,where the speedup can be 10 x.?WebAssembly makes the Web competitive with native:WebAssembly is designed as a compiler target for multiple languages.That includes C and C+,and in many areas of software the best implementations are in those languages,for example,game engines like Unity and Unreal,design software like AutoCAD,etc.It would take many years to write comparable products in JavaScript;instead,by compiling them to WebAssembly,the Web can be on par with native platforms today.?WebAssembly also fills an industry need outside the Web:WebAssembly is fast,portable,sandboxed,has multiple excellent open source implementations,and just like the Web itself it is an industry standard expected to be supported for the long term.As a result,its not surprising that WebAssembly is starting to be used outside of browsers,for example in the blockchain and content delivery network(CDN)spaces.Looking back,its remarkable that our industry has gotten to this point.Just a few years ago,there was no cross-browser collaboration on getting native code to run on the Web.Instead,there were multiple options,including Native Client,Adobe Alchemy,and ASM.js,each with its own advantages and disadvantages.I believe it was the momentum of ASM.js that got the industry to focus on fixing IV 深入浅出 WebAssembly things:ASM.js started out in Firefox,and by virtue of being a subset of JavaScript it immediately ran in all browsers-just not as efficiently.That led top companies in the video game industry and elsewhere to adopt ASM.js,together with Emscripten,the open source compiler to JavaScript that I started in 2010,and which could emit ASM.js.That adoption led to ASM.js support in Edge and later Chrome,at which point there was consensus that the industry should produce a proper standard in this space,which turned into WebAssembly.As the spec was designed and implementations started to appear,we added WebAssembly support to Emscripten,which allowed people to compile to both ASM.js and WebAssembly by just flipping a switch,making it easy for people to use the new technology.Finally,as of May 2018 Emscripten emits WebAssembly by default,and today WebAssembly has robust and stable support both in all major browsers and in the toolchain projects that emit it.Its been a complicated path to get here,but the future looks bright.It is especially worth noting that WebAssembly is expected to add features like multithreading,SIMD,GC,and others,which will open up even more interesting opportunities.Alon Zakai Alon is a researcher at Mozilla,where he works on compile-to-Web technologies.Alon co-created WebAssembly and ASM.js,and created the Emscripten and Binaryen open source projects which are part of the primary WebAssembly compiler toolchain.译文:我很高兴能够看到这本书的出版,作者在书中详细地介绍了有关WebAssembly的各种主题。在这本书即将出版之际,WebAssembly 差不多一岁了如果从所有主流的 Web 浏览器开始支持 WebAssembly 算起,那么这