Weekend LOIs: Edge improvements and fuller Gmail support

Published by at

A couple of links of interest from Microsoft from the last couple of days. Firstly, there have been big performance improvements to the Edge browser for the Creators Update - the post goes into how some of the magic happens. Secondly, there's fuller Windows 10 Mobile Gmail integration rolling out to Insiders in the next few weeks, but there's a caveat that you might like to think about beforehand.

From the Edge post:

Saving memory by re-deferring functions

Back in the days of Internet Explorer, Chakra introduced the ability to defer-parse functions, and more recently extended the capability to defer-parse event-handlers. For eligible functions, Chakra performs a lightweight pre-parsing phase where the engine checks for syntax errors at startup time, and delays the full parsing and bytecode generation until functions are called for the first time. While the obvious benefit is to improve page load time and avoid wasting time on redundant functions, defer-parsing also prevents memory from being allocated to store metadata such as ASTs or bytecode for those redundant functions. In the Creators Update, Microsoft Edge and Chakra further utilizes the defer-parsing mechanism and improves memory usage by allowing functions to be re-deferred.

The idea of re-deferring is deceptively simple – for every function that Chakra deems would no longer get executed, the engine frees the bulk of the memory the function holds to store metadata generated after pre-parsing, and effectively leaves the function in a deferred state as if it has just been pre-parsed. Imagine a function foo which gets deferred upon startup, called at some point, and re-deferred later.

Illustration showing a function foo which gets deferred upon startup, called at some point, and re-deferred later.

The tricky part about re-deferring is that Chakra cannot perform such actions too aggressively or it risks frequently re-paying the cost of full-parsing, bytecode generation, etc. Chakra checks its record of function call counts every N GC cycles, and re-defers functions that are not called over that period of time. The value of N is based on heuristics, and as a special case a smaller value is used at startup time when memory usage is more susceptible to peak. It is hard to generalize the exact saving from re-deferring as it is very subject to the content served, but in our experiment with a small sample of sites, re-deferring typically reduces the memory allocated by Chakra by 6-12%.

Better performance for minified code

Using a minifier before deploying scripts has been a common practice for web developers to reduce the download burden on the client side. However, minifiers could sometimes pose performance issues as they introduce code patterns that developers typically would not write by hand and therefore might not be optimized.

Previously, we’ve made optimizations in Chakra for code patterns observed in UglifyJS, one of the most heavily-used minifiers, and improved performance for some code patterns by 20-50%. For the Creators Update, we investigated the emit pattern of the Closure compiler, another widely used minifier in the JavaScript ecosystem, and added a series of inlining heuristics, fast paths and other optimizations according to our findings.

The changes lead to a visible speedup for code minified by Closure or other minifiers that follow the same patterns. As an experiment to measure the impact consistently in a well-defined and constrained environment, we minified some popular JavaScript benchmarks using Closure and noticed a 5~15% improvement on sub-tests with patterns we’ve optimized for.

The post goes on in considerable detail, talking about WebAssembly, Shared Memory and Atomics - do you need to know about ANY of this stuff? Of course, you don't. But it's reassuring to note that there's so much work being done behind the scenes to make the Edge browser work faster and more efficiently.

We've come a long way since simple HTML tags and their rendering. [As seen on my own web page, with a coding style from 1995, 22 years ago!]

From the post around the Gmail experience:

Over the past year we’ve introduced many new features in Windows 10 Mail & Calendar apps for users with Outlook.com accounts—such as easily tracking travel and shipping deliveries, making emails more actionable, helping you easily track your favorite sports events, faster search, and more. We’re now excited to bring these features to our users with Gmail accounts, so you can enjoy the best of what Windows 10 Mail & Calendar have to offer.

We’ll roll out the improved experience gradually to users with Gmail accounts in the Windows Insiders program over the next several weeks.  We’d love for you to provide feedback on the experience in this phase.  After we’ve incorporated your feedback, we’ll proceed to roll out the updates to all Windows 10 users.

Bringing new features to your Gmail account

Mail & Calendar apps have long supported connecting to and managing your Gmail account. But up until now, some capabilities were only available to those with an Outlook.com or Office 365 email address. With these updates, our latest features will be available for your Gmail account, including Focused Inbox and richer experiences for travel reservations and package deliveries.

To power these new features, we’ll ask your permission to sync a copy of your email, calendar and contacts to the Microsoft Cloud. This will allow new features to light up, and changes to update back and forth with Gmail–such as creation, edit or deletion of emails, calendar events and contacts. But your experience in Gmail.com or apps from Google will not change in any way.

How to get started

The new experience will first be made available to Mail & Calendar users who are part of the Windows Insider program – though not all Insiders will see the new experience on their Gmail account right away. We will expand the rollout gradually over the next few weeks. You’ll know the new experience is available for your account when you are prompted to update your Gmail account settings. If you miss the first prompt, we will remind you again in a few weeks.

Hmm.... This is all very well, but a) I'm quite happy with Gmail access in Windows 10 Mobile at the moment, and b) I'm very sceptical about importing all my Google email and PIM stuff into Outlook and my Microsoft account - perhaps this is a recipe for duplicate contacts and calendar appointments, and not for the first time. Who's going to be brave and be the guinea pig then? Volunteers?!