Friday, June 28, 2024

Porting Google Sheets Calculations to WasmGC

Michael Thomas and Thomas Steiner Thomas Steiner (via Hacker News):

The Google Sheets calculation engine was originally written in Java and launched in 2006. In the early days of the product, all calculation happened on the server. However, from 2013, the engine has run in the browser using JavaScript. This was originally accomplished through Google Web Toolkit (GWT), and later through Java to Closure JavaScript transpiler (J2CL).

[…]

The Sheets team uses this tool regularly to validate changes to Sheets. But the team didn’t just compare the results of those calculations, they also compared the performance between JavaScript on the client and Java on the server. They found that the JavaScript version of the calculation engine was more than three times slower than the Java version.

[…]

By mid 2021, the teams had a working Java to WasmGC compiler. Toward the end of the same year, they had a prototype version of Google Sheets running as WasmGC and doing calculations.

[…]

After all these optimizations, the final WasmGC version of Sheets achieves a calculation performance approximately twice as fast as JavaScript, representing a fourfold improvement from the starting point of the initial WasmGC version.

1 Comment RSS · Twitter · Mastodon


So, lots of work to get a 50% slowdown from running on the server. I guess this is an improvement since the CPU usage is no longer Google's concern.

Java: 100
JS: 300
Unoptimized WASM: 600
Optimized WASM: 150

Leave a Comment