javascript - WebAssembly 使用什么引擎?

标签 javascript performance browser webassembly

在 Chrome 中,JavaScript 运行在 V8 引擎上,但是运行 WebAssembly 代码的引擎是什么?

浏览器如何突然能够通过 WebAssembly 提供改进的性能?这个 WebAssembly 引擎是在浏览器中始终可用,还是最近才添加到浏览器中?

最佳答案

自 2017 年 11 月以来,WebAssembly 仅受所有主要浏览器(Chrome、Firefox、Safari、Edge)支持,这意味着旧版本的浏览器不支持 WebAssembly。 ( blog post from mozilla )

要了解为什么 WebAssembly 比 Javascript 更快,请参阅 Lin Clark (link) 的精彩系列。

article 的结论是报价

WebAssembly is faster than JavaScript in many cases because:

  • fetching WebAssembly takes less time because it is more compact than JavaScript, even when compressed.
  • decoding WebAssembly takes less time than parsing JavaScript.
  • compiling and optimizing takes less time because WebAssembly is closer to machine code than JavaScript and already has gone through optimization on the server side.
  • reoptimizing doesn’t need to happen because WebAssembly has types and other information built in, so the JS engine doesn’t need to speculate when it optimizes the way it does with JavaScript.
  • executing often takes less time because there are fewer compiler tricks and gotchas that the developer needs to know to write consistently performant code, plus WebAssembly’s set of instructions are more ideal for machines.
  • garbage collection is not required since the memory is managed manually.

关于javascript - WebAssembly 使用什么引擎?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50787083/

相关文章:

javascript - 基于UA的动态PHP内容条件加载

javascript - 是否可以在 dart 编辑器中添加 javascript 语法突出显示?

javascript - 使用 Javascript/Jquery 正确写入输入文本的 html 内部值

excel - 有没有办法加快这个 VBA 宏的运行速度,以在 1000 次的大范围内执行 Vlookup?

javascript - Cookies 或 localstorage 是最好的方法?

html - 字体在 chrome 上看起来有点粗

javascript - parsley.js 不适用于 ckeditor textarea

javascript - JavaScript 中的 'Execution Context' 到底是什么?

c# - P/Invoke 调用 CreateEnvironmentBlock 最多需要 30 秒?

performance - `private[this] def` 何时比 `private def` 具有性能优势?