英文:
WASI vs Web-Assembly
问题
我遇到了 WebAssembly(Wasm),甚至尝试了一些使用 WebAssembly 的代码。最近我了解了 WASI,并且注意到区块链中的以太坊 Ewasm 和 Cosmos Coswasm。它们之间的主要区别是什么?WASI 何时是正确的解决方案,以及应该何时使用 WebAssembly?
英文:
I came across the web-assembly wasm, even I tried some of the code using web-assembly, Recently I read about wasi and I notice Ethereum Ewasm, Cosmos coswasm in the blockchain. What is main difference between them? When is WASI the right solution and when should WebAssembly be used?
答案1
得分: 19
WASI是WASM的扩展,不仅可以在Web上运行,还可以在任何平台上运行。WebAssembly提供了一个概念性机器的构建目标,这意味着单个二进制文件可以在不同的处理器和计算机上运行(而不必构建多个不同的二进制文件)。WASI提供了一个概念性的操作系统,这意味着程序可以使用一组通用的命令和子程序与操作系统交互,而无需重写以处理不同操作系统之间的差异。
如果您的代码只需要在浏览器中运行,应该使用WebAssembly。如果您的程序需要与操作系统交互,您可能考虑使用WASI。
英文:
WASI is an extension of WASM to run not only on the web, but on any platform. WebAssembly provides a build target for a conceptual machine, meaning that a single binary can be run on different processors and computers (rather than having to build multiple different binaries). WASI provides a conceptual operating system which means that a program can use a common set of commands and subroutines to interact with the operating system without needing to be rewritten to handle the differences between operating systems.
If your code only needs to run in the browser you should use WebAssembly. If you are interacting with an operating system in a program you might want to consider using WASI.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论