Dylan
Dylan

Reputation: 9373

HTML5 apps: how to make Javascript faster?

I'm trying to make a HTML5 word-game that should eventually be wrapped into an app for Android and iOS.

For now, I only tried Phonegap / Cordova to build the app, but it is VERY slow on my 2-year old Android 2.3.3 phone. Operations (like indexing the dictionary file or finding all words that start with a certain prefix) that take only 100ms in Chrome on my desktop, take up to 2 SECONDS on my phone. I know this is because Phonegap uses the Android Browser, which is very slow on 2.3.3.

So, what are my options now? I want this app to be able to run smoothly on Android 2.3.3.

I read about CocoonJS, Trigger.io and appMobi (now Intel SDK). I know these techniques can improve canvas performance, but will they let my Javascript run faster too ?

Maybe there are other solutions that really compile the Javascript into native code?

Or some HTML5 wrapper that I'm unaware of that includes a version of Chromium instead of using the Android Browser?

Upvotes: 1

Views: 453

Answers (1)

Imnl
Imnl

Reputation: 456

With CocoonJS your app will run under a optimized engine so your app will run significantly faster, still they recommend some Javascript good practises for performance optimizing that you should take care of them. The point is to help JavaScript compiler following some coding rules. Here you have some slides done by @mortimergoro of the engineering team of Ludei that explain the behavior of JavaScript compiler: http://goo.gl/0RdhIY

Upvotes: 2

Related Questions