Hacker News new | past | comments | ask | show | jobs | submit login

Is this true? I was under the impression that webassembly was capable of faster performance than JS, and thinking about learning a compiled languages to make my web applications faster. Would that be a waste of time?



It would not be a waste of time if you learned something. Here's a quick exercise: Write an "hello world" app and compile it to WebAssembly. Then open browser dev tools to inspect the app. You will see that a middle layer is needed to put that "hello world" on the screen. Just like JS, WebAssembly can't talk directly to the hardware and need to use the same browser API's as JS.

Besides obfuscating and being able to compile desktop apps to the web platform, one use-case for WebAssembly that might bring an performance improvement is to use it for something you currently use a Web Worker for. For example sending a bit buffer to the worker, have it do some work on it, and send it back. There is however a penalty to sending the data back and forth, although there are work being done that allows shared memory, which will make both JS and Web-assembly faster.

JavaScript is compiled to optimized native code. So you will get away with really stupid code - the optimizer will make it fast. But the more you learn, you will be able to write even faster apps. It really doesn't matter what programming language you use, it's more important to have experience and tribal knowledge of the platform you are targeting.

A funny thing about performance is that the more you know, the slower your app could become. If you for example use highly sophisticated abstractions, make use of frameworks and preprocessors, together with an orchestra of cloud functions and services with IPC message across oceans - then it will be slow. If you want performance - just keep it simple.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: