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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Google Sheets ported its calculation worker from JavaScript to WasmGC

450 点作者 microflash11 个月前

27 条评论

markdog1211 个月前
Maybe I'm missing it, but it says it was originally twice as slow as JS, than it says they did optimizations, then no comparison on the final outcome?
评论 #40811857 未加载
评论 #40811456 未加载
评论 #40810675 未加载
评论 #40810819 未加载
评论 #40810096 未加载
评论 #40810732 未加载
评论 #40811448 未加载
dgb2311 个月前
I didn&#x27;t know WasmGC was a thing yet!<p><a href="https:&#x2F;&#x2F;developer.chrome.com&#x2F;blog&#x2F;wasmgc&#x2F;" rel="nofollow">https:&#x2F;&#x2F;developer.chrome.com&#x2F;blog&#x2F;wasmgc&#x2F;</a><p>Some things that are at first glance surprising is that GC&#x27;ed languages might ship a smaller binary, because they don&#x27;t need to include the code that manages memory. (The example here was Java.)<p>When WasmGC is widely adopted, we might hopefully see some languages adopting it as a target instead of JS. I&#x27;m thinking of Clojure and Dart specifically but there are plenty of other languages that might benefit here.<p>This could also have an impact on &quot;edge computing&quot; (isolates etc.) down the line.
评论 #40810863 未加载
评论 #40810833 未加载
评论 #40817671 未加载
tjlav511 个月前
It’s perhaps telling that they had an initial prototype which was 2x slower, then talk about specific optimization strategies but never share the updated overall speed comparison.
评论 #40810168 未加载
londons_explore11 个月前
Anyone here actually bothered by the speed of the core calculation engine of Google sheets?<p>I&#x27;m bothered by the sluggishness of the UI, but I&#x27;ve never typed &#x27;=A1+A2&#x27; in a box and found it takes too long to get an answer.<p>Even if it did, I&#x27;d kinda like million row X million column sheets to somehow be server side and my machine simply views a local window, and calculations happen locally if feasible with locally available data, or server side otherwise.
评论 #40820810 未加载
评论 #40816200 未加载
评论 #40810973 未加载
评论 #40812090 未加载
评论 #40817926 未加载
评论 #40816858 未加载
评论 #40812691 未加载
评论 #40810920 未加载
mirkodrummer11 个月前
They also mention that “there are cases where browser APIs are backed by optimized native implementations that are difficult to compete with using Wasm … the team saw nearly a 100 times speedup of regular expression operations when switching from re2j to the RegExp browser API in Chrome” if so how they call RegExp from WasmGC or viceversa? 100 times speedup for native web apis is not something you can ignore, that’s the important lesson here, not everything compiled to wasm will result in a speed again
评论 #40810711 未加载
评论 #40810918 未加载
评论 #40810255 未加载
davexunit11 个月前
Nice to hear from teams building with Wasm GC. They bring up the &quot;shared everything&quot; proposal [0] for enabling heap objects to be shared across the threads. In addition to this, I&#x27;d like to be able to share the contents of a packed array, such as a (ref (array i8)), with the host. Right now, only Wasm memory objects have ArrayBuffer access in JS. Providing the same shared access to packed GC arrays would unlock things like WebGL, WebGPU, and Web Audio for Wasm GC applications. I made a &quot;hello triangle&quot; WebGL program with Wasm GC awhile back, but there&#x27;s no way that I know of to get acceptable throughput when working with GPU buffers because they have to be copied byte-by-byte at the Wasm&#x2F;JS boundary.<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;WebAssembly&#x2F;shared-everything-threads&#x2F;blob&#x2F;main&#x2F;proposals&#x2F;shared-everything-threads&#x2F;Overview.md">https:&#x2F;&#x2F;github.com&#x2F;WebAssembly&#x2F;shared-everything-threads&#x2F;blo...</a>
ZuLuuuuuu11 个月前
As somebody who is not familiar with how garbage collection is implemented at the low level, can somebody explain why WasmGC is needed on top of Wasm?<p>For example, isn&#x27;t CPython a C program and hence can just be compiled to Wasm, including its garbage collection part? Does garbage collection usually depend on OS specific calls, which are not part of C standard?
评论 #40810712 未加载
评论 #40810736 未加载
评论 #40811782 未加载
评论 #40810721 未加载
评论 #40811054 未加载
hankman8611 个月前
It is not entirely clear from the article, but apparently, they still use Java for their calculation engine. And then transpile it into JavaScript. Which makes me wonder whether instead of porting this code base to WasmGC, a partial rewrite would have helped the project’s maintain ability in the long run. Rust seems like a potentially good candidate due to its existing WebAssembly backend.<p>WasmGC is useful for many other projects of course. But I wonder how painful it is to maintain a Java code base, which is not a great choice for client-side web apps to begin with. I remember using GWT back in the days - and that never felt like a good fit. GWT supported a whitelisted subset of the Java standard library. But the emitted Javascript code was nigh on impossible read. I don’t remember if Chrome’s developer tools already had source map support back in those days. But I doubt it. Other core Java concepts like class loaders are equally unsuited for JavaScript. Not to mention that primitive data types are different in Java and JavaScript. The same is true for collections, where many popular Java classes do not have direct counterparts in JavaScript.
评论 #40813223 未加载
评论 #40813140 未加载
评论 #40813156 未加载
Vt71fcAqt711 个月前
They forgot to mention the final speedup:<p>&gt;The initial version of Sheets Wasm showed calculation performance roughly two times slower than JavaScript.<p>&gt;[...]<p>&gt;Implementing speculative inlining and devirtualization—two very common optimizations—sped up calculation time by roughly 40% in Chrome.<p>So the only numbers we get are 2x slowdown and the 1.4x speedup, which makes it sound like it&#x27;s still slower. I&#x27;m sure thats probably not the case but it is a strange way to write an article advertising wasm.<p>Also, I&#x27;m a bit confused about which language this was actually written in before the wasm switch. Was it always written in Java and transpiled to JS? It doesn&#x27;t seem that way from the article:<p>&gt;Removing JavaScript-specific coding patterns.<p>&gt;they had a core data structure in Sheets which was blurring the lines between arrays and maps. This is efficient in JavaScript<p>which doesn&#x27;t make sense if they were writing it in Java and transpiling to JS.<p>Was it transpiled to JS only once in 2013 and then developed in JS from there? In which case why go back to Java?
评论 #40810212 未加载
boutell11 个月前
With infinite effort, a company with infinite resources made something that is already objectively fast enough twice as fast!<p>They are right though that wasmgc might have a bigger impact than wasm alone. Lots of attention is deservedly paid to Rust but people use garbage collected languages more.
评论 #40813431 未加载
评论 #40816875 未加载
bahmboo11 个月前
This is the kind of cool cutting edge web development that google excels at. Hopefully there are some down stream effects that help more tools move to the web. Good work!
评论 #40815405 未加载
bhl11 个月前
It seems this is not a full rewrite of the calculation engine, so it’s hard to compare the performance of JavaScript against WASM.<p>Has anyone rewritten a performant calculation in that way from JavaScript to WASM? I’m curious to what the performant gap is, and whether browser optimizations are closing or widening that gap.
pjmlp11 个月前
I love how we are slowly back to Applets and related plugins.<p>WebGL | WebGPU + WasmGC =&gt; Flash!
sirjaz11 个月前
Maybe they can finally make Google Sheets, etc... off-line stand alone app.
评论 #40810075 未加载
评论 #40812306 未加载
bbor11 个月前
Slightly off topic, but since the GenAI push google has started investing heavily into its devtools again, namely Sheets and Colab. Either that or these teams are just that good! If you haven&#x27;t checked out the recent &quot;Tables&quot; update to Sheets, I highly recommend it -- probably the most meaningful improvement in years.
murkle11 个月前
When will Safari have WasmGC?
评论 #40811878 未加载
评论 #40811905 未加载
tsujp11 个月前
I&#x27;ll need to look into this but if anyone knows: is this available (easily) as a standalone package somewhere; think using the engine from a CLI without needing or contacting Google Sheets at all.
cxr11 个月前
&gt; <i>they had a core data structure in Sheets which was blurring the lines between arrays and maps. This is efficient in JavaScript, which automatically models sparse arrays as maps, but slow on other platforms. So they had to rewrite the code in a more platform-agnostic way. This is another thing the team like about WebAssembly: it makes it easier for multiplatform applications to get good performance on the web. You don&#x27;t have to bend your whole application to the idiosyncrasies of JavaScript.</i><p>Uh, that&#x27;s a terrible example. It&#x27;s not an example of anyone forced to &quot;bend their whole application to the idiosyncrasies of JS&quot; at all. It&#x27;s almost the opposite<p>Someone wrote the code they wanted to write, whether in good taste or not, and the JS runtimes that the product was tested on handled it efficiently (to their credit!); i.e., the authors of those JS runtimes had to bend their implementations to accommodate the idiosyncrasies of people who were&#x2F;are writing code like that.
zengid11 个月前
This is really cool, I wonder what .NET to wasmGC would be like.
评论 #40813408 未加载
zengid11 个月前
WasmGC: Revenge of the JVM
AshleysBrain11 个月前
This is a bit of a tangent but it always annoys me when content has no published date next to it. There&#x27;s a tiny &quot;last updated&quot; date at the bottom. But how do we know if this is a new article or one from a few years back? With technology moving so fast it can significantly change the context in which you read an article.
评论 #40810572 未加载
评论 #40809898 未加载
评论 #40810672 未加载
评论 #40810542 未加载
评论 #40810038 未加载
评论 #40811493 未加载
评论 #40810527 未加载
评论 #40810612 未加载
评论 #40810004 未加载
royjacobs11 个月前
It&#x27;s great to see Java Web Start finally being used in anger 24 years after its initial release.
评论 #40817125 未加载
评论 #40809793 未加载
评论 #40810616 未加载
whoomp1234211 个月前
Why is javascript slower than java?<p>uhhhh I don&#x27;t think there is actually a real answer in that paragraph that compares PERFORMANCE of JS to JAVA.<p>that explanation is completely unhinged?
评论 #40812620 未加载
bongwater_OS11 个月前
is this why all my gsheets scripts started failing out of nowhere today
macspoofing11 个月前
Google finally got NaCL&#x2F;Pepper into the browser.
评论 #40817150 未加载
davidmurdoch11 个月前
I still long for a world where we got ASM.js and SIMD directly in JavaScript.
评论 #40817042 未加载
评论 #40810707 未加载
评论 #40810744 未加载
评论 #40810782 未加载
devit11 个月前
How about writing it properly in an efficient language that doesn&#x27;t use a GC? (i.e. Rust or something equivalent)
评论 #40817195 未加载