Performance of WebAssembly: a thread on threading
By Jordon Mears, Tech Lead Manager, Google Earth on Web
It’s been a while since we’ve discussed moving Earth towards WebAssembly (WASM) and away from Native Client (NaCl). In my last article, I talked about how WebAssembly is the new W3C standard way of compiling native applications for the web. This technology is in the process of being standardized and adopted by browsers across the industry. Recent advancements in WASM’s threading support is paving the way for Earth to provide a smooth experience across browsers.
Take a look at this side-by-side comparison of how Earth performs with and without threads.
At the 2018 Chrome Dev Summit we presented some performance metrics of the gains Earth gets when using threads. Let me give you a better breakdown of this with more detail.
Better Performance with Threads
One way to think about Google Earth is as a really big video game of the whole world. We’re constantly streaming 3D data and imagery across the network, decompressing it and then showing it on the globe. Fetching and decompressing data on background threads allows the main rendering loop to execute much faster, resulting in higher average framerate:
Also, there is a lot less frame dropping in a threaded experience:
Details of the test:
- Ran on a stripped down version of Earth that would fly the camera from location to location in a prescribed order.
- Used Google Chrome Version 72.0.3602.2 (Official Build) dev (64-bit) on a device with the following hardware: Linux Kernel 4.17.0; Processor Intel Core i7–6600U CPU @ 2.600GHz x 2; Memory 15.6 GiB; Graphics Card Intel Corporation HD Graphics 520.
- Repeated multiple times with the first few runs for each type thrown out to help support caching of network fetches and the remaining results averaged.
Earth on WASM coming soon
The advantage of threading support in the case of Earth is a pretty clear improvement for the user experience. We’re excited to see major browsers working towards supporting threading by default. Chrome has recently added support starting with version 74. We are also looking forward to default support of LLVM which will provide faster builds, better debugging, and SIMD support.
We look forward to sharing preview access in the coming weeks.