The Google Earth team recently released a beta preview of a WebAssembly port of Google Earth. The new port runs in Chrome and other Chromium-based browsers, including Edge (Canary version) and Opera, as well as Firefox. The port thus brings cross-browser support to the existing Earth For Web version, which uses the native C++ codebase and Chrome’s Native Client (NaCl) technology. The difference in multi-threading support between browsers leads to varying performance.

Google Earth was released 14 years ago and allowed users to explore the earth through the comfort of their home. This original version of Google Earth was released as a native C++ based application intended for desktop install because rendering the whole world in real time required advanced technologies that weren’t available in the browser. Google Earth was subsequently introduced for Android and iOS smartphones, leveraging the existing C++ codebase through technologies such as NDK and Objective-C++. In 2017, Google Earth was released for the Chrome browser, using Google’s Native Client (NaCl) to compile the C++ code and run it in the browser.

Thomas Nattestad, product manager for Web Assembly, V8 and Web Capabilities, explains the drivers behind the WebAssembly port of Google Earth:

As the Web progressed, we wanted Earth to be available on the platform so it could reach as many people as possible and let them experience the entire world at their fingertips. Web apps offer a better user experience because they’re linkable, (…) they’re secure, since users aren’t at risk of viruses that can come with software downloads, and they’re composable, meaning we can embed them in other parts of the web.

(…) Using WebAssembly, we see more possibilities not just for making apps more accessible across browsers, but smoothing out the online experience, as we’ve seen with Google Earth.

With the WebAssembly port, Google Earth is now available in Chrome, Edge (Canary channel) and Opera, as well as Firefox. It is not available however in Safari or the current public version of Edge, as those browsers lack full support for WebGL2.

Further differences between browsers impact Google Earth performance. A key factor is support for multi-threading. Jordon Mears‎, tech lead manager for Google Earth, explains:

Think of Earth like a huge 3D video game of the real world. As such, we’re constantly streaming data to the browser, decompressing it and making it ready for rendering to the screen. Being able to do this work on a background thread has shown a clear improvement in the performance of Earth in the browser.

Multi-threaded WebAssembly is enabled by a feature called SharedArrayBuffer, which was pulled from browsers due to the Spectre and Meltdown security vulnerabilities. Chrome introduced Site Isolation to remediate the vulnerabilities and re-enabled SharedArrayBuffer for desktop. Other browsers, such as Firefox, still disable SharedArrayBuffer, with a view to bringing back support for multi-threading in future versions. In the meantime, Earth runs single-threaded in those browsers with possibly lower performance.

Future improvements in performance are linked to new features expected to come to WebAssembly, including SIMD support, and Dynamic Linking.