Michael Thomas, the Multiplatform Lead for Google Workspace, and Thomas Steiner, a Developer Relations Engineer at Google, discuss the ambitious shift of Google Sheets from a Java-based calculation engine to using WebAssembly Garbage Collection. They dive into the performance enhancements achieved through this transition and the challenges faced, including adapting existing JavaScript libraries. The conversation also touches on the evolving roles within Google and the broader implications of WebAssembly for multi-platform application development, signaling a bright future for web performance.
Read more
AI Summary
Highlights
AI Chapters
Episode notes
auto_awesome
Podcast summary created with Snipd AI
Quick takeaways
The transition of Google Sheets' calculation engine from JavaScript to WasmGC significantly enhanced performance, doubling its execution speed while managing complex operations effectively.
The porting process highlighted challenges in performance measurement due to privacy concerns, necessitating innovative solutions that leveraged optimized JavaScript APIs for improved efficiency.
Deep dives
The Evolution of Google Sheets' Calculation Engine
Google Sheets' calculation engine was originally developed in Java and operated on the server until it transitioned to running in the browser using JavaScript in 2013. The recent upgrade involves porting its calculation worker from JavaScript to WebAssembly Garbage Collection (Wasm GC), marking a significant technical advancement. This change allows for improved performance, as calculations, which were constrained by JavaScript's limitations, can now be executed more efficiently through Wasm GC. The engine now supports complex operations without hindering user experience, allowing for background calculations while users interact with the sheet.
Performance Gains from Wasm GC Implementation
The migration to Wasm GC resulted in doubling the performance of the calculation engine compared to its JavaScript counterpart. Initially, after deployment, it performed slower, revealing the necessity for optimization to achieve this improved speed. After a year of targeted enhancements, the engine now performs calculations twice as fast, nearing the execution speed of Java code on the Java Virtual Machine (JVM). This substantial performance boost also alleviates user frustration experienced during calculations in larger spreadsheets.
Unique Challenges Faced During the Porting Process
The porting process encountered various challenges, particularly in measuring performance due to privacy concerns surrounding user documents. Engineers were restricted from accessing spreadsheets that were slow, complicating the optimization efforts. Additionally, differences between JavaScript and other programming environments meant rewriting several libraries, particularly regarding data structures and regular expressions, that had not been optimized for WebAssembly. Tackling these hurdles led to the realization that leveraging JavaScript's optimized APIs, such as its regex engine and string handling, significantly enhanced performance.
The Future of WebAssembly and Multi-Platform Development
WebAssembly, particularly with Wasm GC, opens up new possibilities, allowing developers to write applications in various programming languages beyond just JavaScript. This flexibility supports the growth of multi-platform applications, enabling smoother deployments across web, Android, and iOS. As technology progresses, expectations are high that more languages will compile to WebAssembly seamlessly, reducing the reliance on JavaScript and improving overall application performance. This could lead to a paradigm shift in how developers approach web application development, ultimately increasing the quality and performance of user experiences.
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, starting in 2013 the engine has run in the browser using JavaScript.
Google Sheets is now one of the first products at Google to use WebAssembly Garbage Collection, or WasmGC, on Chrome.
Michael Thomas is the Multiplatform Lead for Google Workspace and Thomas Steiner is a Developer Relations Engineer at Google. They join the podcast to tell the story of why and how Google Sheets ported its calculation worker from JavaScript to WasmGC.
Sean’s been an academic, startup founder, and Googler. He has published works covering a wide range of topics from information visualization to quantum computing. Currently, Sean is Head of Marketing and Developer Relations at Skyflow and host of the podcast Partially Redacted, a podcast about privacy and security engineering. You can connect with Sean on Twitter @seanfalconer.