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.

Ask HN: Is C++ logic code using WASM faster than JavaScript logic code?

3 pointsby anon115over 1 year ago
say both logic code do the exact same thing but just written in C++ or Javascript will speed time be noticeable?

5 comments

threatripperover 1 year ago
This needs way more context. In general C++ is slower to develop and harder to maintain if you don&#x27;t already have dedicated C++ developers and your code is being developed in C++.<p>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&#x27;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.<p>In conclusion: I&#x27;m 99% sure that you&#x27;re asking the wrong question.
pjmlpover 1 year ago
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.<p>And if doing 3D stuff, you&#x27;re better off doing performance critical stuff on shaders, powered by the GPU, than dealing with C++ targeting WebAssembly.
ksherlockover 1 year ago
The wasmboy benchmark compared typescript compiled to javascript vs typescript compiled to wasm and the wasm code has 40-60% higher fps.
AA-BA-94-2A-56over 1 year ago
Varied answers in here, but honestly it depends. We’re not at the stage where one is clearly better than the other.
andsoitisover 1 year ago
&gt; Is C++ logic code using WASM faster than JavaScript.<p>No. The JavaScript code will be faster.