Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ask HN: Is C++ logic code using WASM faster than JavaScript logic code?
3 points by anon115 on Jan 24, 2024 | hide | past | favorite | 5 comments
say both logic code do the exact same thing but just written in C++ or Javascript will speed time be noticeable?


This needs way more context. In general C++ is slower to develop and harder to maintain if you don't already have dedicated C++ developers and your code is being developed in C++.

Usually the best thing to do is to build a working prototype with tools that are most efficient in building working prototypes. If your idea doesn't do the job you save a lot of time and money. If it does the job really well you will have a lot of pain due to the technical debt that you acquired but you will also a lot of money to pay for the pain.

In conclusion: I'm 99% sure that you're asking the wrong question.


WASM code (regardless of the language), will usually be faster if it is mostly compute and little DOM interactions, as doing that requires going through JavaScript anyway.

And if doing 3D stuff, you're better off doing performance critical stuff on shaders, powered by the GPU, than dealing with C++ targeting WebAssembly.


The wasmboy benchmark compared typescript compiled to javascript vs typescript compiled to wasm and the wasm code has 40-60% higher fps.


Varied answers in here, but honestly it depends. We’re not at the stage where one is clearly better than the other.


> Is C++ logic code using WASM faster than JavaScript.

No. The JavaScript code will be faster.




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

Search: