Microsoft is Finally Ditching Electron

Faisal Khan on 2021-08-24

Microsoft recently announced that they have reached a whopping 250 Million active users with Teams. Not Word or Excel but Teams is the rockstar of the Microsoft Office suite. But, It has always been plagued with performance issues as it consumes heaps of system resources. Running Teams is a nightmare on computers with less memory to work with.

Behind its ultra-modern, fluid user interface of ocean blue and pearl white widgets, It runs a demon in the form of a Chromium instance that throttles host computers and inadvertently sets their fans in motion.

Image by Uzair Ahmed from Pixabay

The Announcement from Microsoft

The senior vice president of Microsoft Teams announced that Teams would be moving to their own Edge Webview2 Rendering Engine ditching Electron for seeking performance gains. It is marketed that Teams would consume 2x less memory as a result of the transition. It would be called Teams 2.0 and might ship with Windows 11 in late 2022.

The Electron Problem

There are tons of well-known apps powered by Electron. The Electron framework helps web developers ship their web apps to the desktop platform evading platform-specific intricacies. Since a unique instance of Chrome OS runs in the backend of every Electron app, running more than two such apps takes the juice out of the host machine.

Teams, which does a lot of processing on top of Electron has become synonymous with hogging memory and slowing down computers. Microsoft even has a documentation page explaining why Microsoft Teams might have high memory use.

The Genesis of Teams on Webview2

Webview2 cannot be thought of as a replacement to Electron; It is not a wrapper like Electron to rapidly ship web apps on the desktop platform. The original Webview (Webview1 for namesake) used Microsoft’s Edge rendering engine while the Webview2 uses the Chrome rendering engine. Webview2 is already used by Outlook as a part of Microsoft’s “One Outlook” project.

Image Source: Microsoft

Unlike Electron, WV2 monitors Chromium's behaviour to detect how much system memory is available and utilizes that memory effectively to optimize the rendering experience. If other apps or services required system memory, Chromium then gives up that memory to those processes. This improves the performance significantly on low-end computers with less memory to work with.

WV2 can be thought of as a control like a window of an app; A control that renders web pages. In fact, the Webview2 control allows embedding web technologies (HTML, CSS, and JavaScript) in native apps. For an app of Teams size to transition to WV2, A lot of abstraction provided by Electron will have to be rewritten. As a result, Teams would essentially become close to a native Windows app.

The way ahead

Teams does a lot of things with audio and video and Microsoft thinks that it is best to offload some of that work on the native level which Webview2 facilitates that are not done efficiently with the abstraction of Electron.

Teams basically got too big for Electron. Electron was a great and only choice to ship on desktop as well as web back in 2017 but optimization is the only way forward in Tech. This may be a pivotal milestone in the ever-changing landscape of cross-platform frameworks. It could also be just a Teams specific change that only Microsoft can pull off.