Back to Blog Home
← all posts

What is new in NativeScript 2.1

July 7, 2016 — by Valio Stoychev

NativeScript 2.1 is now live! Quick links - upgrade now or read the full release notes (total of 118 GitHub issues were closed!).

If I have to mention just two highlights in this release these will be 1) performance improvements in Android (both load time and runtime performance) and 2) much faster and stable LiveSync (HotReload) functionality as part of your development process.

Let's start first with the performance improvements.

App load time improvements in Android

With the 2.0 release you could use WebPack to optimize the loading time of the NativeScript applications.

With the introduction of V8 heap snapshot in 2.1 for the core NativeScript framework we managed to reduce significantly the loading time in Android. See the performance results below:

Startup time tested on a Nexus 5 device (model Nov.2013):

Configuration

Core NativeScript

Non-bundled

2350 ms

Bundled with snapshot

1600 ms

As you can see this is about 30% faster loading time. We know how important is the loading time of an app and we hope that this addition to the framework is welcome. Please note that this optimization is not enabled by default when you create a new app. To read more about how to enable this in your app please refer to this documentation article. If you are really keen how this works you can check the source code in the repo.

Runtime optimizations in Android

While we are using native UI components to build the user experience of the applications, there is still code that enables the binding between the JavaScript code you write and these native elements. Several of our clients reported that in certain cases the Android performance is lagging when compared to iOS, so we did a major profiling of these Android applications and based on the profiler results we made a number of improvements in our cross - platform modules. We also found more things we can optimize, so expect further performance optimizations in Android in our next release - 2.2.

Here is a more detailed list of optimizations we have made. Please note that many of they affect the iOS performance too, because they are in the cross-platform layer. So expect improved iOS performance too:

  • Reduced the overhead when setting value (for our dependency properties)

  • Optimized Binding operations – when changing the data item most of the overhead is completely removed. Most visible in ListView component.

  • Removed native scrollListener for android ListView which results in better FPS when scrolling

  • iOS Image component now have loadMode=”async” property which results in loading and decoding the image/imageSource on a background thread. Again best perceived when scrolling ListView

  • Label component now implemented as native control for iOS in order to reduce marshaling overhead.

  • ListView now use new property – isLayoutRequired to skip the layout pass if possible

  • iOS Image and Label components now won’t invalidate layout if setting src/text won’t change their dimensions

More info is available in the GitHub issue.

Tooling improvements

We’ve made tons of improvements (well 36 closed issues on GitHub!) in the CLI. We also just released a new version of our Visual Studio Code extension for NativeScript. See the changes here.

For all you out there who want to live on the edge we also added support for Node.js v6.

Localization plugin

Localization is very important for mobile apps and I want to highlight the work of Dan Tamas, from RBORN, who implemented the localization plugin. Please read more about this plugin in this separate blog post - i18n Internationalization support for different languages in NativeScript.

Angular RC(X) support

Angular is changing a lot these days, just ask our engineers :). We try to stay on top of any changes and to update our Angular SDKs ASAP when a new Angular release is publicly available.

To test the latest Angular bits please follow the Angular and NativeScript getting started article.

NativeScript Developer Conference

In case you missed, we are hosting the first ever Developer Conference in Boston in September. Hurry up to register, the seats are limited and the ticket price will be a nice surprise to you I’m sure.

Please share the news with your twitter followers! and happy NativeScripting - I know it is fun!