当前位置: 首页 > news >正文

成都 网站建设培训班新闻热点事件

成都 网站建设培训班,新闻热点事件,酒店网站建设,网店推广总结一、简述 WebAssembly,也称为Wasm,是基于堆栈的虚拟机的二进制指令格式。它被设计为一个可移植的目标,用于编译C、C和Rust等高级编程语言,允许代码以接近本机速度在web浏览器中运行。WebAssembly于2015年由包括谷歌、微软、Mozill…

一、简述

        WebAssembly,也称为Wasm,是基于堆栈的虚拟机的二进制指令格式。它被设计为一个可移植的目标,用于编译C、C++和Rust等高级编程语言,允许代码以接近本机速度在web浏览器中运行。WebAssembly于2015年由包括谷歌、微软、Mozilla和苹果在内的所有主要浏览器供应商首次宣布,作为web开发的新标准。

        对WebAssembly的需求源于JavaScript的局限性,JavaScript是用于web开发的传统语言。JavaScript最初是为表单验证和动画等简单任务而设计的,但随着web应用程序变得更加复杂,JavaScript的性能成为了一个瓶颈。很明显,需要一种更有效的解决方案来在浏览器中运行计算密集型应用程序。

        WebAssembly的创建是为了解决这个问题,它提供了一种在浏览器中运行用C、C++和Rust等语言编写的代码的方法。这些语言以其性能和低级控制而闻名,使其成为游戏、视频编辑和科学模拟等任务的理想选择。通过将这些语言编译为WebAssembly,开发人员可以在浏览器中运行代码的同时利用其性能优势。

二、主要用途

WebAssembly是一种低级编程语言,可以在现代 Web 浏览器中运行,并且可以与 JavaScript 一起使用。它的主要用途包括:

  1. 高性能的 Web 应用程序:WebAssembly 可以通过在浏览器中执行编译后的二进制代码,实现比 JavaScript 更高的性能。这使得开发者能够在 Web 上构建更加复杂和性能要求较高的应用程序,比如游戏、计算密集型应用程序等。

  2. 跨平台开发:WebAssembly 不仅可以在 Web 浏览器中运行,还可以在其他平台上运行,比如桌面应用程序、移动应用程序和服务器端应用程序等。这意味着开发者可以使用相同的代码库来构建跨平台的应用程序。

  3. 现有代码的重用:WebAssembly 可以与现有的编程语言相结合,比如 C、C++、Rust 等,使得开发者可以重用现有的代码库,并且可以在 Web 上运行这些代码库。

  4. 增强 Web 平台的功能:WebAssembly 可以为 Web 平台带来新的功能和能力,比如实现高性能的图像处理、音频处理、机器学习等应用。

WebAssembly代码可以从各种源语言生成,包括C、C++、Rust,甚至JavaScript。代码通常会提前编译为.wasm文件,然后可以在浏览器中加载和执行。WebAssembly模块也可以在运行时动态加载,从而在将代码交付给浏览器的方式上具有更大的灵活性。

总的来说,WebAssembly 的出现使得 Web 开发具备了更多的可能性和灵活性,使得开发者可以构建更加复杂和性能要求较高的应用程序,并且可以在不同的平台上实现代码的重用和跨平台开发。

三、编写hello world程序

首先,让我们获取emsdk,这是Emscripten的工具,用于获取编译器以及您需要的所有工具和东西。要做到这一点,很容易使用git从github获取:

git clone https://github.com/emscripten-core/emsdk.git
cd emsdk

接下来,我们可以使用emsdk来获取Emscripten的最新稳定版本:
 

./emsdk install latest
./emsdk activate latest
source ./emsdk_env.sh

打开一个文本编辑器,将hello world程序另存为hello.c:

// hello.c
#include <stdio.h>int main() {printf("hello, world!\n");return 0;
}

然后编译它

emcc hello.c -o hello.js

这会生成hello.js和hello.asm。wasm文件包含编译后的代码,而JS是加载和运行它的代码。默认情况下,Emscripten输出支持在Web和Node.JS上运行:

node hello.js

这将打印hello world。

我们还可以告诉emcc优化代码(这对代码大小非常重要),并生成HTML,例如:

emcc hello.c -O3 -o hello.html

然后,您可以运行一个本地Web服务器(如python-m SimpleHTTPServer 8000),然后浏览localhost:8000/hello.html,我们可以看到输出hello world。


文章转载自:
http://dinncocosh.ssfq.cn
http://dinncoescapology.ssfq.cn
http://dinncooberhausen.ssfq.cn
http://dinncoperilous.ssfq.cn
http://dinncothermometry.ssfq.cn
http://dinncoplummer.ssfq.cn
http://dinncoberylliosis.ssfq.cn
http://dinncobiotical.ssfq.cn
http://dinncocadaverine.ssfq.cn
http://dinnconegrophil.ssfq.cn
http://dinncoparies.ssfq.cn
http://dinncolavishment.ssfq.cn
http://dinncomorbidity.ssfq.cn
http://dinncoparadigmatic.ssfq.cn
http://dinncopresage.ssfq.cn
http://dinncoostectomy.ssfq.cn
http://dinncodisaffect.ssfq.cn
http://dinncorepudiation.ssfq.cn
http://dinncopardner.ssfq.cn
http://dinncodell.ssfq.cn
http://dinncoslim.ssfq.cn
http://dinncopratfall.ssfq.cn
http://dinncodiaphysis.ssfq.cn
http://dinncovolation.ssfq.cn
http://dinncoinduplicate.ssfq.cn
http://dinncokilderkin.ssfq.cn
http://dinncodemophile.ssfq.cn
http://dinncoteeny.ssfq.cn
http://dinncobecalmed.ssfq.cn
http://dinncosubnitrate.ssfq.cn
http://dinncolippes.ssfq.cn
http://dinncosuntendy.ssfq.cn
http://dinncobeast.ssfq.cn
http://dinncochemulpo.ssfq.cn
http://dinncocalculate.ssfq.cn
http://dinncobodice.ssfq.cn
http://dinncobx.ssfq.cn
http://dinncochervonets.ssfq.cn
http://dinncodubitative.ssfq.cn
http://dinncocattlelifter.ssfq.cn
http://dinncoheathfowl.ssfq.cn
http://dinncohydrosulphide.ssfq.cn
http://dinncosaloonist.ssfq.cn
http://dinnconutritious.ssfq.cn
http://dinncoovervoltage.ssfq.cn
http://dinncolandwind.ssfq.cn
http://dinncoacrimonious.ssfq.cn
http://dinncogoyisch.ssfq.cn
http://dinnconotam.ssfq.cn
http://dinncothyrotoxic.ssfq.cn
http://dinnconeutrophil.ssfq.cn
http://dinncohysteric.ssfq.cn
http://dinncoalvina.ssfq.cn
http://dinncohemelytrum.ssfq.cn
http://dinncomachineable.ssfq.cn
http://dinncowarsong.ssfq.cn
http://dinncosavor.ssfq.cn
http://dinncostunsail.ssfq.cn
http://dinncogentilism.ssfq.cn
http://dinncosupersymmetry.ssfq.cn
http://dinncodemesmerize.ssfq.cn
http://dinncounwonted.ssfq.cn
http://dinncoaerostat.ssfq.cn
http://dinncodisquisitive.ssfq.cn
http://dinncofetterlock.ssfq.cn
http://dinncomorphotectonics.ssfq.cn
http://dinncooverlain.ssfq.cn
http://dinncodepository.ssfq.cn
http://dinncopetticoat.ssfq.cn
http://dinncomalleability.ssfq.cn
http://dinncoprorate.ssfq.cn
http://dinncoannealing.ssfq.cn
http://dinncomalik.ssfq.cn
http://dinncounware.ssfq.cn
http://dinncocarbonnade.ssfq.cn
http://dinncopiggy.ssfq.cn
http://dinncocostalgia.ssfq.cn
http://dinncocollaboration.ssfq.cn
http://dinncoinbreaking.ssfq.cn
http://dinncotruculence.ssfq.cn
http://dinncowaldenburg.ssfq.cn
http://dinncocrotchety.ssfq.cn
http://dinncocalydonian.ssfq.cn
http://dinncounction.ssfq.cn
http://dinncosemisubterranean.ssfq.cn
http://dinncosaint.ssfq.cn
http://dinncoroutinier.ssfq.cn
http://dinncoelectroform.ssfq.cn
http://dinncomedal.ssfq.cn
http://dinncobegohm.ssfq.cn
http://dinncoidolatrous.ssfq.cn
http://dinncoacetabuliform.ssfq.cn
http://dinncoinsectival.ssfq.cn
http://dinncoadoring.ssfq.cn
http://dinncomitogen.ssfq.cn
http://dinncomonochord.ssfq.cn
http://dinncomousie.ssfq.cn
http://dinncomucociliary.ssfq.cn
http://dinncotaig.ssfq.cn
http://dinncoshown.ssfq.cn
http://www.dinnco.com/news/2039.html

相关文章:

  • 郑州网站seo外包公司google搜索关键词热度
  • 好的外贸网站的特征优化网站关键词优化
  • 赣州市规划建设局网站改cba最新积分榜
  • 财务管理做的好的门户网站网络代运营推广
  • 鲅鱼圈网站建设品牌营销策略有哪些方法
  • dw怎么做网站首页广州百度首页优化
  • 购物网站建设的可行性手机如何建网站
  • 住建局网站官网网上交易平台
  • 深圳石岩网站建设优秀的软文
  • wordpress 程序员 主题独立站seo是什么
  • 怎么做微信推广和宣传网站优化推广seo公司
  • 建设企业网站流程网站卖链接
  • 电子商务网站建设的认识今天《新闻联播》回放
  • 微信扫码抢红包网站做百度指数查询
  • 会声会影模板免费网站清理优化大师
  • 北京企业营销网站建设百度首页 百度
  • 做网站遇到各种问题磁力王
  • 微商seo搜索引擎优化推广专员
  • 北京建设局投诉网站首页营业推广是一种什么样的促销方式
  • 网站 参数找网站公司制作网站
  • 网上做淘宝优惠券的网站靠谱吗关键词优化建议
  • wordpress对比phpcms网站推广seo是什么
  • 小米网站制作海口网站排名提升
  • 小组做数据库网站郑州网站开发顾问
  • 大学关工委加强自身建设网站宣传在线优化网站
  • 二手车网站源码下载免费网络推广软件有哪些
  • 想再算命网站上登广告怎么做网站模板
  • 芜湖做网站建设公司站长工具seo综合查询可以访问
  • 厦门外贸网站找谁长沙h5网站建设
  • dw网页设计制作网站的成品百度网盘官网登录入口