Performance, Top Tabris.js Feature #6

May 13, 2015 | 2 min Read

For the past week I’ve been celebrating the release of Tabris.js 1.0 by counting down the Top 10 Tabris.js features that I’m most excited about. Tabris.js is a mobile app development framework that enables you to develop your mobile apps entirely in JavaScript. Performance is key to any successful app, and keeping Tabris.js highly performant was the goal from day one.

Number 6 on my list is performance.

With Tabris.js you can write truly native mobile apps entirely in JavaScript. Unlike other frameworks that use webviews or a cross-platform intermediate runtime, Tabris.js executes the JavaScript directly on your device and renders everything using native widgets. In addition to native widgets and native gestures, native performance is key.

To achieve a high performance runtime we used the fastest JavaScript runtimes on each platform. For iOS this was a simple choice as you can bind to an efficient JS runtime right from Objective-C, but on Android, it was more complicated.  On Android, Nashorn is not available, and Rhino is very slow. The problem with Rhino (and Nashorn) is that in order to optimize them you must pre-compile your JavaScript to Java bytecode and execute that bytecode on the JVM – but Android doesn’t actually use the JVM.

To solve this, we created a highly efficient JavaScript runtime for Android based on V8 – J2V8.

                 JavaScript performance

J2V8 wraps the V8 API and exposes it in Java through a JNI bridge. This also allows us to keep up-to-date with newer ECMAScript standards as V8 is being actively developed.

When we first started Tabris.js we used Rhino, and our animation demos ran at about 10-15 FPS. With V8 now powering Tabris.js on Android, we can run smooth animations at 60 FPS.

To try this yourself, simply install Tabris.js Developer Apps and run the Canvas or Animation demos. To develop and deploy your own apps, visit https://tabrisjs.com. For more information and to hear about the Top 5 Tabris.js features, follow us on Twitter.

Ian Bull

Ian Bull

Ian is an Eclipse committer and EclipseSource Distinguished Engineer with a passion for developer productivity.

He leads the J2V8 project and has served on several …