Why Google Sheets ported its calculation worker from JavaScript to WasmGC
Google Sheets transitioned its calculation worker to WasmGC from JavaScript for improved performance. Collaboration between Sheets and Chrome teams led to optimizations, overcoming challenges for near-native speed on the web.
Read original articleGoogle Sheets transitioned its calculation worker from JavaScript to WasmGC, a move announced in 2022. The Sheets and Chrome teams collaborated on standardization and tooling to optimize performance. Initially written in Java in 2006, the calculation engine shifted to JavaScript in 2013, resulting in slower performance compared to the Java version. WasmGC, an extension of WebAssembly, was chosen for its potential to bring garbage collected languages to the web at near-native speed. The migration faced challenges such as tooling and library replacements, but optimizations like replicating core JVM and V8 optimizations, utilizing browser APIs, and removing JavaScript-specific patterns improved performance. The Sheets team's efforts led to a prototype running on WasmGC by late 2021, with subsequent optimizations narrowing the performance gap with JavaScript. Google aims to further enhance WasmGC for shared memory multithreading and single-threaded performance, encouraging developers to consider it for high-performance web projects.
Related
20x Faster Background Removal in the Browser Using ONNX Runtime with WebGPU
Using ONNX Runtime with WebGPU and WebAssembly in browsers achieves 20x speedup for background removal, reducing server load, enhancing scalability, and improving data security. ONNX models run efficiently with WebGPU support, offering near real-time performance. Leveraging modern technology, IMG.LY aims to enhance design tools' accessibility and efficiency.
Wc2: Investigates optimizing 'wc', the Unix word count program
The GitHub project "wc2" presents an innovative algorithm for the `wc` program, focusing on asynchronous state-machine parsing in C and JavaScript. It enhances efficiency, scalability, and speed compared to traditional `wc` implementations.
What Happens When You Put a Database in the Browser?
WebAssembly (Wasm) enhances browser capabilities, enabling high-performance apps like DuckDB for ad-hoc queries and Python environments. DuckDB Wasm boosts performance in interfaces like lakeFS, Evidence, and Count. MotherDuck enables local querying, emphasizing efficient data processing.
Google no longer developing Material Web Components
Material Web is a library of web components based on Material 3 for creating attractive and accessible web apps. Components are in maintenance mode, seeking new maintainers. Visit the Material Web GitHub for details.
Google no longer developing Material Web Components
Google has ceased active development of Material Web Components (MWC) and shifted focus to its internal Wiz framework. MWC is now in maintenance mode, with engineers reassigned. Angular Material remains available.
https://developer.chrome.com/blog/wasmgc/
Some things that are at first glance surprising is that GC'ed languages might ship a smaller binary, because they don't need to include the code that manages memory. (The example here was Java.)
When WasmGC is widely adopted, we might hopefully see some languages adopting it as a target instead of JS. I'm thinking of Clojure and Dart specifically but there are plenty of other languages that might benefit here.
This could also have an impact on "edge computing" (isolates etc.) down the line.
I'm bothered by the sluggishness of the UI, but I've never typed '=A1+A2' in a box and found it takes too long to get an answer.
Even if it did, I'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.
[0] https://github.com/WebAssembly/shared-everything-threads/blo...
For example, isn'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?
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.
>The initial version of Sheets Wasm showed calculation performance roughly two times slower than JavaScript.
>[...]
>Implementing speculative inlining and devirtualization—two very common optimizations—sped up calculation time by roughly 40% in Chrome.
So the only numbers we get are 2x slowdown and the 1.4x speedup, which makes it sound like it's still slower. I'm sure thats probably not the case but it is a strange way to write an article advertising wasm.
Also, I'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't seem that way from the article:
>Removing JavaScript-specific coding patterns.
>they had a core data structure in Sheets which was blurring the lines between arrays and maps. This is efficient in JavaScript
which doesn't make sense if they were writing it in Java and transpiling to JS.
Was it transpiled to JS only once in 2013 and then developed in JS from there? In which case why go back to Java?
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.
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.
WebGL | WebGPU + WasmGC => Flash!
Uh, that's a terrible example. It's not an example of anyone forced to "bend their whole application to the idiosyncrasies of JS" at all. It's almost the opposite
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/are writing code like that.
uhhhh I don't think there is actually a real answer in that paragraph that compares PERFORMANCE of JS to JAVA.
that explanation is completely unhinged?
Related
20x Faster Background Removal in the Browser Using ONNX Runtime with WebGPU
Using ONNX Runtime with WebGPU and WebAssembly in browsers achieves 20x speedup for background removal, reducing server load, enhancing scalability, and improving data security. ONNX models run efficiently with WebGPU support, offering near real-time performance. Leveraging modern technology, IMG.LY aims to enhance design tools' accessibility and efficiency.
Wc2: Investigates optimizing 'wc', the Unix word count program
The GitHub project "wc2" presents an innovative algorithm for the `wc` program, focusing on asynchronous state-machine parsing in C and JavaScript. It enhances efficiency, scalability, and speed compared to traditional `wc` implementations.
What Happens When You Put a Database in the Browser?
WebAssembly (Wasm) enhances browser capabilities, enabling high-performance apps like DuckDB for ad-hoc queries and Python environments. DuckDB Wasm boosts performance in interfaces like lakeFS, Evidence, and Count. MotherDuck enables local querying, emphasizing efficient data processing.
Google no longer developing Material Web Components
Material Web is a library of web components based on Material 3 for creating attractive and accessible web apps. Components are in maintenance mode, seeking new maintainers. Visit the Material Web GitHub for details.
Google no longer developing Material Web Components
Google has ceased active development of Material Web Components (MWC) and shifted focus to its internal Wiz framework. MWC is now in maintenance mode, with engineers reassigned. Angular Material remains available.