TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

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

3 点作者 anon115超过 1 年前
say both logic code do the exact same thing but just written in C++ or Javascript will speed time be noticeable?

5 条评论

threatripper超过 1 年前
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.
pjmlp超过 1 年前
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.
ksherlock超过 1 年前
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-56超过 1 年前
Varied answers in here, but honestly it depends. We’re not at the stage where one is clearly better than the other.
andsoitis超过 1 年前
&gt; Is C++ logic code using WASM faster than JavaScript.<p>No. The JavaScript code will be faster.