android-snapshot

Feeding the Android Runtime with V8 heap snapshots

OTHER License

Stars
11
Committers
14

Deprecated

The plugin is now deprecated. V8 heap snapshot generation is now integrated with Webapck bundling being an optional optimization step after code bundling. We recommend migrating your apps to use nativescript-dev-webpackwith enabled snapshot generation. More info on how to setup Webpack bundling in NativeScript you can find here.

This repo provides tools to generate and distribute V8 heap snapshot packages of the Core NativeScript / NativeScript+Angular modules to reduce the startup time of the NativeScript Android Runtime.

For more information follow NativeScript#1563 and look at the Android Runtime docs.

What You'll Find

  • /bundler - A JavaScript module bundler and tool to create snapshot packages.
  • /plugin - NativeScript plugin that downloads the correct snapshot package and prepares the app for using it.

Getting Started

To install the plugin:

tns install android-snapshot

Results

Startup time tested on a Nexus 5 device:

Configuration Core NativeScript NativeScript+Angular
Non-bundled 2350ms 4000ms
Bundled 2100ms 3600ms
Bundled with snapshot 1600ms 2100ms

Requirements

  • NativeScript CLI 2.1
  • NativeScript Runtime for Android 2.1

Limitations

  • APK file size will be increased with 1.5MB (6MB with Angular).
  • The installed application size will be increased with an additional 1.2MB (5MB with Angular).
  • It is not possible to step into the embedded script from VS Code. You must use the CLI if you want to debug it.
  • LiveSyncing may work in most cases, but is not officially supported.
  • Snapshots are not compatible with the NativeScript webpack plugin.