{"id":24298081,"url":"https://github.com/wanderhuang/rust-webassembly-benchmark","last_synced_at":"2026-01-21T01:32:57.707Z","repository":{"id":47736773,"uuid":"391299001","full_name":"WanderHuang/Rust-WebAssembly-Benchmark","owner":"WanderHuang","description":"simple life game. compare wasm with js, js win again.","archived":false,"fork":false,"pushed_at":"2021-11-25T08:18:32.000Z","size":414,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-09T05:11:59.654Z","etag":null,"topics":["module-federation","rust","wasm"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WanderHuang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-31T08:35:24.000Z","updated_at":"2023-03-04T04:29:24.000Z","dependencies_parsed_at":"2022-07-26T16:45:07.780Z","dependency_job_id":null,"html_url":"https://github.com/WanderHuang/Rust-WebAssembly-Benchmark","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/WanderHuang/Rust-WebAssembly-Benchmark","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WanderHuang%2FRust-WebAssembly-Benchmark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WanderHuang%2FRust-WebAssembly-Benchmark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WanderHuang%2FRust-WebAssembly-Benchmark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WanderHuang%2FRust-WebAssembly-Benchmark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WanderHuang","download_url":"https://codeload.github.com/WanderHuang/Rust-WebAssembly-Benchmark/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WanderHuang%2FRust-WebAssembly-Benchmark/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28621654,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T23:49:58.628Z","status":"ssl_error","status_checked_at":"2026-01-20T23:47:29.996Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["module-federation","rust","wasm"],"created_at":"2025-01-16T20:53:50.371Z","updated_at":"2026-01-21T01:32:57.685Z","avatar_url":"https://github.com/WanderHuang.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wasm和原生js对比\n\n新技术的出现是有一些道理的，`wasm`解决了预编译为字节码的问题。我们来看一下究竟它是快多少？\n\n---\n\n\u003e `wasm`技术不仅可以使用在浏览器中作为`js`的模块引入，相反，`wasm`的设计是跨平台和跨应用的，它既可以作为任意语言的中间表示(`IR`)，也可以作为任意语言的安全沙盒或者容器。\n\u003e 这方便了在任意需要容器的场景，整合不同语言的功能，实现动态加载和卸载。\n\n---\n\n## 最新比较【所有图都可点击查看大图】\n\n![性能BAR](https://user-images.githubusercontent.com/18475942/129734234-50fb9a60-fa6a-489c-b452-3960f2356d76.png)\n\n\n### 生命游戏\n\n`Rust`优化后速度奇快，我愿吹爆！！！\n\n#### \u003e 快得不是一点点🤏 \u003c\n![生命游戏性能对比](https://user-images.githubusercontent.com/18475942/129570314-8a36f09e-9976-49ee-9dfa-7e493e2809c7.png)\n\n\u003cimg width=\"472\" alt=\"截屏2021-08-11 下午11 27 41\" src=\"https://user-images.githubusercontent.com/18475942/129058708-9b4696c7-100c-4ff6-88d3-1eb6c0e5d5f5.png\"\u003e\n\n文章地址: [这里](https://rustwasm.github.io/docs/book/game-of-life/time-profiling.html)\n\n### dijkstra算法\n\n目前还看不出有太大差别，继续优化相信有奇效\n\n#### \u003e 快了一丢丢🤏  (200节点)\u003c\n![最短路径算法](https://user-images.githubusercontent.com/18475942/129570688-bca8ffd0-5f49-46d1-a28a-54729d942ca0.png)\n\n## 结果\n\n`wasm` \u003e `js`。在一些特定的计算场景，`wasm`可以把速度提升好几倍。\n\n## 运行方式\n\n需要安装`wasm-pack`环境。\n\n`yarn \u0026 yarn build:wasm \u0026 yarn start`\n\n```bash\nyarn\nyarn build:wasm\nyarn start:wasm\nyarn start\n```\n\n## 结构\n\n```\n===========host=================\n========/======\\================\n===dijkstra========life-game====\n====|================|==========\n======== js \u0026 wasm =============\n= module federation ==== rust ==\n=====\\=====================/====\n===== webpack 5 =====wasm-pack==\n```\n\n## 测试进程\n\n- 20211125 增加Rust后台服务使用wasm的示例，后续可以对比作为容器和沙盒环境使用的`wasm`模块\n\n- 20210818 之前的测试有些对rust做了优化但没有对js做优化，今天对js也做了优化，现在的结果算是比较公平\n\n- 20210816 自己会一些优化手段后，写出来的代码果然`wasm`更快，所以还是自己需要花时间去钻研啊！😊\n\n- 20210811 发现了一册宝藏[开源书](https://rustwasm.github.io/docs/book/)。基于这篇文章优化后`Rust`非常快！！！！\n\n- 20210803测试了引入`js-sys`后，使用`Date.now`来计算时间，这个也不理想。还不如不计算。另外就是`std::time::SystemTime`这个库好像不被支持，一使用就`unreachable`。然后在一个群里问了大家，也没有什么好的性能优化结果。暂时又搁浅吧。继续看有没有库能够超过`js`性能的\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwanderhuang%2Frust-webassembly-benchmark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwanderhuang%2Frust-webassembly-benchmark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwanderhuang%2Frust-webassembly-benchmark/lists"}