Google Sheets: Calculations twice as fast

The Sheets spreadsheet now calculates twice as fast: Google has been working for years on replacing the JavaScript engine and returning to Java.

Save to Pocket listen Print view
Google Chrome icon with drawing in Chrome colors

(Image: iX)

2 min. read
This article was originally published in German and has been automatically translated.

Google wants to achieve twice as fast calculations in Sheets – however, Chrome or Microsoft Edge are required for a snappy spreadsheet at the start. In the future, Firefox and Apple Safari will also be supported web browsers.

Under the hood, the WebAssembly Garbage Collection (WasmGC) is responsible for the doubled calculation speed, which allows Google to return to Java with Sheets. Microsoft Edge is based on Chromium – Google does not comment on other web browsers based on this in the announcement.

The engine responsible for the calculations was originally based on Java. This implementation dates back to 2006 and was designed to outsource all calculations to Google servers. Since 2013, however, Google has switched to local calculations in the browser using JavaScript. To ensure that both versions calculate the same results, the developers added a validation mechanism in Sheets.

The same validation mechanism also compared the speed of the calculations – with the sobering result that the JavaScript version of the engine is more than three times as slow as the old Java implementation. This is particularly evident with large tables, as can be seen from Google's blog post.

Since 2020, Google has therefore been working on a return to Java via WebAssembly (Wasm), a browser platform that runs other programming languages such as C or Rust, which are then converted to JavaScript by Wasm. A garbage collector is required for the high-performance use of Java, which Google is now bringing into productive use with WasmGC.

During development, the programmers wrote a special compiler for Wasm to replace the old JavaScript libraries from Sheet. Validating the mathematical calculations also took a lot of time. A first prototype was ready at the beginning of 2022.

However, it was twice as slow as the JavaScript version at the start. The developers then adopted optimizations from the Java Virtual Machine (JVM) and V8, relied on more optimized browser APIs and removed JavaScript-specific code patterns. They then achieved the current, better-performing version that is now being used by users.

The announcement and the detailed contribution to the development can be found in Google's blogs.

(fo)