TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Porting a JavaScript App to WebAssembly with Rust (Part 1)

116 pointsby alex_hirnerover 5 years ago

12 comments

cervedover 5 years ago
While it&#x27;s just part one, I feel like whether the end result successfully overcomes the problems mentioned is missing. I wonder if in fact it does.<p>Personally I wouldn&#x27;t refactor an entire application from scratch unless it was fairly simple. Instead I prefer incremental refactoring and I&#x27;ve found that typescript can be helpful in that regard.
评论 #21852040 未加载
pythuxover 5 years ago
Interesting take, but there is no indication that the new Rust-based stack will be « less expensive » to maintain than the current one. I am curious to see the next posts in the series. I would also like to know if they considered other alternatives; they mention Elm, what about TypeScript. The issues they mention seem to also have to do with the specific choice of frameworks or tools: React, Webpack, etc. Not so much with JavaScript itself?
评论 #21851902 未加载
评论 #21852038 未加载
Tade0over 5 years ago
While I love Rust, I don&#x27;t think this here is a good use case for it - TypeScript nowadays works really well with JSX and can be introduced incrementally.<p>Rust&#x27;s guarantees work best in a highly concurrent setting - a web app isn&#x27;t really one.<p>Rust shines not on the application level, but on the framework&#x2F;library level, where things like memory usage and performance are critical.<p>A framework with virtual DOM written entirely in Rust would go a long way. Same with a template compiler.
评论 #21852484 未加载
评论 #21852494 未加载
评论 #21852533 未加载
评论 #21852474 未加载
评论 #21852663 未加载
Rotten194over 5 years ago
I thought DOM manipulation from WASM was pretty expensive because it needs to be bridged through JS -- is that still true?
评论 #21851644 未加载
评论 #21851597 未加载
fnord77over 5 years ago
&gt; In the next series we&#x27;ll see how to translate the legacy JavaScript code to working Rust code.<p>this is the part I came to see.
crtlaltdelover 5 years ago
<a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=kY-pUxKQMUE" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=kY-pUxKQMUE</a><p>seriously though, i’ve been very interested to see how webassembly adoption goes. does anyone have examples of new projects implemented in webassembly? i’ve seen lots of examples of ports, but am more curious about its use in product development.
mattlondonover 5 years ago
Sounds like typescript and angular would be a better fit here.<p>Angular is &quot;batteries included&quot; compared to react, so you generally won&#x27;t hit the same dependency hell since angular comes with pretty much everything you need (although not redux pattern support (yet)). Typescript is a strictly-typed JavaScript.<p>Reprogramming a web front end in rust sounds like a way to lead to huge maintenance issues in the future (i.e. you need to find developers who know rust AND how frontends and things like redux actually work - you&#x27;ll probably get someone who is good at one, and half-assed at the other). I am also uncertain how you&#x27;d debug things in the browser for wasm - e.g. would the redux Dev tools work?<p>Where I see wasm as useful is if you are doing any heavy-lifting in the browser - so all the examples they give on the various web sites about games and cryptography etc, but probably also parsing&#x2F;serialisation of binary data from the server for example. I don&#x27;t feel like basic SPA stuff is a good fit.
bobajeffover 5 years ago
This is cool. I&#x27;ll be paying attention to this. If for no other reason than to see what it&#x27;s like porting from one language to another.
pkolaczkover 5 years ago
While Rust is a very cool technology, I don&#x27;t think it is the best tool for web development. Manual memory management and constant thinking about ownership and memory sharing is additional productivity overhead, and you don&#x27;t gain anything from it because the final code is running in a GCed runtime anyways.<p>I&#x27;d use TypeScript or Scala.js.
评论 #21852431 未加载
评论 #21852306 未加载
sammorrowdrumsover 5 years ago
Did anyone find a subscribe link? I&#x27;m curious to see how this progresses.
评论 #21851284 未加载
jorblumeseaover 5 years ago
This seems like a solution looking for a problem but cool to see. A far more practical suggestion would be to just use typescript and incrementally rewrite.
austincheneyover 5 years ago
&gt; Maintaining Software that is written in a dynamically typed language like JavaScript is costly. Maintaining a JavaScript frontend that is build with React, NPM, WebPack and Babel is even more expensive.<p>Not exactly. In modern browsers JavaScript executes in a VM. If the JavaScript instance is written in a strongly typed way it executes quickly by receiving the full benefits of a compiled language. Aside from arithmetic it executes almost as fast as Java. That is one of the strengths of TypeScript.<p>I do completely agree about NPM, dependency overkill, and framework insanity.<p>In short, don’t blame the language for being slow. Blame marketing and bad developers. That being said I have little faith that WASM will be fast once it meets the reality of bad developers and marketing teams.
评论 #21851011 未加载
评论 #21851897 未加载
评论 #21851370 未加载