Editors Note: This is a post that’s part of a series on Platform Engineering at Appcelerator.
This is the first in a series of blog posts from the Appcelerator Engineering team on upcoming platform improvements planned through the rest of this year. Performance of applications on Android has been on the radar for quite some time and the technology has progressed to the point where we can finally address it in a meaningful way.
Up until recently, we had a dilemma with attempting to bring V8 into a production release. In order to use V8 (which is in C/C++), we had to wait for Google to provide a stable Native Development Kit (NDK) which provides application binary interface (ABI) compatibility to different CPU architectures. This all happened with 2.2 and now that the market for older release has dropped significantly, we now feel confident we can fully switch Titanium to V8 and massively improve performance. We typically drop support for older platforms when their market presence as reported by the Android Market Statistic page drops to 10% or lower.
In our testing, the V8 runtime is performing two times that of the current Rhino runtime and we can expect much higher performance gains once we fully get this ready. The V8 port is under active development and we hope to have the beginning of a development branch soon. We are also continuing to address performance issues in the Rhino implementation as it will continue being offered since not all Android implementations support the Android NDK yet (like Google TV).
Sun spider comparisons
The following are the results of the Sun Spider tests.
Pseudo code used: Test Case with 10,000 iterations of JS->Java bridge
V8: C++ binding using a function pointer, function pointer invokes JNI -> Java class / object
Test platform / hardware:
Android 2.2 (Froyo) HTC Evo
Runtimes: V8 from the Froyo 2.2 branch Rhino 1.7.3 CVS
Object and Prototype accessors
Code used: Test Case of 50,000 iterations of setting properties to an empty object on a custom prototype, and again on an object instance (100k iterations total)
Test platform / hardware:
Android 2.2 emulator, default AVD options T-Mobile G-Slate, Android 3.0.1 HTC Desire, Android 2.2 iPhone 4, iOS 5.0 beta
V8 from the Froyo 2.2 branch Rhino 1.7.3 CVS titanium_mobile revision f7c0117 (+ TiCore)
As you can see from the raw performance results, V8 looks to perform even better the iOS in a lot of cases.
At this moment, we don’t have a specific release date but we are working very fast to bring this release to market with a target for late Fall. As you might imagine, adding another runtime is a non-trivial task, so we will be testing that the Rhino and V8 implementations behave the same before we release V8. We are significantly expanding our unit test coverage this past quarter and focused on bringing more tests online before we finalize the release.
Other performance improvements
V8 isn’t the only performance improvement we’re working on – although it is significant. We are looking at a number of other performance improvements such as introducing a new declarative UI which will allow us to compile the UI into a native compiled UI (such as layout XML for Android and NIB for iOS) as well as providing much more hooks to allow us to optimize the native code bindings.
How you can help?
If you have an application that you’re having problems with for Android related to performance, please let us know by emailing email@example.com. We’d like to build up a set of real life applications that we can use for regression testing as well as performance testing our new builds against in QE. If you don’t mind sharing your source code and helping us ensure it runs on our side, we’ll use this as part of our larger test bed.
We really need help with writing unit tests. We have a team dedicated to writing tests but the API set is large and growing. We use a test framework called Drillbit that is easy to run and included when you fork the code from Github. It’s easy to add new tests and we can run these tests automatically.
We are constantly hiring here at Appcelerator – especially on the platform team. Right now we have 4 open positions on the Android team. If you’re interested in Android and hacking on V8, please let us know by applying at http://jobs.appcelerator.com.
What’s coming next?
As this is the first in a series of post from Engineering I’m going to mention additional topics to be covered in our weekly to bi-weekly updates. - Demo and more performance information of V8 vs Rhino on Android (Next Post) - Changes to API documentation that we’ve been working on since April - Behind the scenes look at Engineering processes - API parity effort - Features upcoming in the next mobile release 1.8.0
In my next post which we should have ready by next week, we’ll provide a demo of the performance of a running test application for you to view. Until then, Codestrong!