最适合优化WASM二进制文件的语言是什么(除了WAT之外)?

huangapple go评论49阅读模式
英文:

What is the best language suited for optimizing of wasm binary (other than WAT)?

问题

我正在研究 WebAssembly(wasm)以提高我的 Web 应用程序中一些数值处理的性能。我已经阅读了《WebAssembly 的艺术》来学习关于 WebAssembly Text (WAT) 的知识。

WAT 的知识非常有用,但当我实际替换数值计算过程为 wasm 时,我计划使用比 WAT 更高级的语言。

目前有许多选择,包括 asm.js、Emscripten(C++)、Rust、Golang 和 AssemblyText 等。

我已经了解到,简单地用另一种可以编译为 wasm 的语言替换 JavaScript 代码并不会有太大作用。从“完全优化性能”的角度来看,哪种语言最适合,即最适合优化 wasm 二进制输出?

我的技能包括 Java、Ruby、JS/TS、Lisp、Golang 等,但请忽略这些先决条件。并且请使用除了 WAT 之外的东西。

英文:

I am looking into wasm to improve the performance of some numerical processing in my web application. And I read "The Art of WebAssembly" to learn about WAT.

The knowledge of WAT is very useful, but I am planning to use a higher level language than WAT when I actually replace the numerical computation process with wasm.

Currently, there are numerous options. asm.js, Emscripten(C++), Rust, Golang, and AssemblyText, etc.

I have already learned that simply replacing Javascript code with another language that can compile to wasm is not going to do much. What language is best suited in terms of "fully optimizing performance", i.e., best suited for optimizing the output of the wasm binary?

My skill set includes Java, Ruby, JS/TS, Lisp, Golang, etc., but please ignore such prerequisites. And please use something other than WAT.

答案1

得分: 1

如果您的目标是Web开发,那么emscripten(C/C++)或AssemblyScript可能是您最好的选择。遗憾的是,针对Web的Rust工具链目前并没有得到很好的维护。

无论您是否能够在性能上超越JavaScript,更多取决于您的功能工作负载,而不仅仅是您选择的源语言。那些计算密集型且与环境互动较少(即Web平台)的工作负载应该非常适合在WebAssembly下表现良好,因此听起来可能会看到一些性能提升。

英文:

If you are targeting the web then emscripten (C/C++) or AssemblyScript are likely your best bet. Sadly, the rust toolchain for targetting the web is not really maintained these days.

Whether or not you see performance gains over JS or more of function workload you have and less about about source language you choose. Workloads that are compute heavy and light on interactions with the environment (i.e. the Web platform) should be well suited to performing well under WebAssembly, so it sounds like could see some gains.

huangapple
  • 本文由 发表于 2023年7月31日 20:45:59
  • 转载请务必保留本文链接:https://go.coder-hub.com/76803776.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定