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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

MNIST training: Showdown between JavaScript and WebAssembly

76 点作者 neptvn大约 7 年前

11 条评论

dvddgld大约 7 年前
I compiled hello world in Rust into wasm the other day for the first time and it was incredibly satisfying for whatever reason. New technology is fun I guess.<p>Note: This page isn&#x27;t rendering properly on iPhone
评论 #16565445 未加载
darknoon大约 7 年前
It would be a more fair comparison to <a href="https:&#x2F;&#x2F;deeplearnjs.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;deeplearnjs.org&#x2F;</a>, since CPU training is not standard practice for neural nets these days.
评论 #16564009 未加载
gok大约 7 年前
This seems like a race between crawling and hopping on one foot.
评论 #16564784 未加载
fulafel大约 7 年前
So what&#x27;s the explanation for the 20x difference? Is the JS implementation untuned?<p>edit: seems the JS is written in the straightforward, idiomatic JS way without employing speed hacks or typed arrays. So that I guess explains some of it.
评论 #16564430 未加载
catman99大约 7 年前
If you care about performance use GPU shaders.
评论 #16564040 未加载
评论 #16563986 未加载
评论 #16566877 未加载
exikyut大约 7 年前
PLEASE NOTE<p>This is NOT a fair and honest comparison.<p>The WebAssembly implementation pegs 100% of one CPU core (as monitored in htop) on my system until it is completed.<p>The JS button sits between 66.2%-66.8% and 19-26% of one core depending on whether the tab is focused or not.<p>The JS version does not use Web Workers. I can, however, see two references to setTimeout(). This leads me to assume that the JS version is being slowed down so that the UI does not lock up.<p>Completely understandable, but patently dishonest, as there is no mention of this fact on the webpage.<p>The JS version should be reimplemented so it can run at 100% speed.
评论 #16566885 未加载
评论 #16565584 未加载
DanRuta大约 7 年前
woah, I never expected this much traffic! Thank you for all the suggestions, don&#x27;t worry, I am still hard at work on this.<p>I&#x27;m currently most focused on designing and implementing a WebGL version (partially working FC forward shader, so far), between uni assignments, trying to see if I can get it working nicely together with WebAssembly (need to figure out the best way to create the contexts with an off-screen canvas).<p>The JS version uses setTimeout to stop locking up the browser, and is something old, which I&#x27;m about to change, in favour of using WebWorkers, and (optionally) collecting error data in an array, for displaying charts at the end of training, instead of during. That should come out in version 3.3, unless the GPU stuff comes out first, in v4.0.<p>I didn&#x27;t expect the link would get posted somewhere, so the library versions used were pretty old, haha, but I&#x27;ll update them now. I&#x27;ve also added a note about the setTimeout thing, which, again, will be removed soon.<p>The repo is here, if anyone was interested: <a href="https:&#x2F;&#x2F;github.com&#x2F;DanRuta&#x2F;jsNet" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;DanRuta&#x2F;jsNet</a>
lol768大约 7 年前
My browser at least seems to struggle to download the file at <a href="https:&#x2F;&#x2F;ai.danruta.co.uk&#x2F;webassembly&#x2F;mnist.js" rel="nofollow">https:&#x2F;&#x2F;ai.danruta.co.uk&#x2F;webassembly&#x2F;mnist.js</a> - how big is this file in total?
评论 #16564232 未加载
make3大约 7 年前
Do webGL now, with this library from Google: <a href="https:&#x2F;&#x2F;deeplearnjs.org&#x2F;#getting-started" rel="nofollow">https:&#x2F;&#x2F;deeplearnjs.org&#x2F;#getting-started</a>
akmittal大约 7 年前
I showed me 1 min as 31 mins
nsthorat大约 7 年前
Come build a WASM backend for deeplearn.js :)
评论 #16570858 未加载