up

Zoompf's Web Performance Blog

Note: Archived Content

This is the archived version of the Zoompf blog. Since our acquisition by Rigor, all our new research and posts on web performance are being published on The Rigor Blog

Apple’s Nitro JavaScript Engine Available To All Apps

 Billy Hoffman on June 10, 2014. Category: random

Last weeks announcement that Safari would support SPDY wasn’t the only interesting piece of web performance news to come out of Apple’s WWDC 2014 event. Apple also announced that, with iOS 8, apps using the embedded web browser control, WKWebView, will gain full access to the powerful Nitro JavaScript engine. And this is a big deal.

apple-logo

JavaScript engines have been undergoing incredible advances over the last several years. As web apps are using more and more JavaScript, the need for faster and faster JavaScript engines grows. This is not an easy task.

Traditional JavaScript engines are fairly basic interpreters. This was by necessity. JavaScript is highly dynamic language, from its dynamically typed variables to its ability to modify itself, its code, and its environment at runtime. Optimizing JavaScript is are harder, can be a more complex problem the optimizing compiled languages like C or C++.

However, in recent years, browser creators have invested heavily in improving JavaScript execution speed by adopting many tricks and techniques from optimizing compilers such as multi-stage JIT compiling and AOT compiling. Enhancements such as JavaScript’s "use strict" strict mode helps reduces some of the flexibility of JavaScript, but enables more accurate analysis of the source code making it easier to apply traditional compiler optimizations. Mozilla’s asm.js project extends this concept even more, further restricting what JavaScript code can do to allow for better optimizations.

The results of all this work is very impressive. For example, Apple’s Nitro engine uses a 4 tier compiling strategy which can execute JavaScript 40 times faster than a traditional JavaScript interpreter!

Unfortunately, this super fast JavaScript interpreter was not available to iOS apps using the embedded web view UIWebView. Those applications had access to a JavaScript engine, but it was just a traditional JavaScript interpreter. Google’s Chrome browser on iOS uses UIWebView and so it could not execute JavaScript as quickly as the built-in Safari browser, which did have access to the fully optimized JavaScript engine. Many iOS apps use UIWebView and were not as fast as they could be due to this limitation. This also impact performance testing applications, like MobiTest, which could not take accurate performance metrics because they could not access the fully optimized JavaScript engine.

Thankfully this is changing. Apple has added the new WKWebView control. This means that future iOS applications will gain access to a optimizing JavaScript engine and all the benefits of faster code execution! iOS 8 should be released some time in fall of 2014.

If you are interested in how JavaScript engines work, then you must care about performance. Which me you you will just love. We find what performance problems your website has and tell you how to resolve them! Zoompf tests your web application for over 400 performance issues. You can get a free performance scan of you website now and take a look at our full product.

Comments

Have some thoughts, a comment, or some feedback? Talk to us on Twitter @zoompf or use our contact us form.