Javascript code in anative appGraphically intensive and interactiveKevin Readkread@boerse-go.de@unverbraucht
Javascript rocks● Its great○ fast○ cross-platform○ runs (nearly) everywhere● So we built a Canvas-based chart analysistool...
● On mobile, canvas not there yet for us○ 2-3 fps performance○ Differences in touch handling over browsers● Porting not an...
Android embedding architectureDalvik VM(Java) App (Views, Activities)
Android embedding architectureDalvik VM(Java)v8Engine singletonJNI(C/C++) BGJSContextv8(JS)JS ChartApp (Views, Activities)...
Android embedding architectureDalvik VM(Java)v8Engine singletonJNI(C/C++) BGJSContextv8(JS)JS ChartBGJSModulesApp (Views, ...
Android embedding architectureDalvik VM(Java)v8Engine singletonJNI(C/C++) BGJSContextv8(JS)JS ChartBGJSModulesApp (Views, ...
Android embedding architectureDalvik VM(Java)v8Engine singletonJNI(C/C++) BGJSContextv8(JS)JS ChartAjax Helper(threading, ...
DemoFinger crossing plz.
Lessons learned and end● Embedding a JS VM is a big to epic win○ Performance gain x20 (!)○ Oh, and works on x86 too of cou...
Upcoming SlideShare
Loading in...5
×

Javascript code in a native app

555

Published on

By Kevin Read

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
555
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Javascript code in a native app

  1. 1. Javascript code in anative appGraphically intensive and interactiveKevin Readkread@boerse-go.de@unverbraucht
  2. 2. Javascript rocks● Its great○ fast○ cross-platform○ runs (nearly) everywhere● So we built a Canvas-based chart analysistool in JS with a gazillion features:○ Quick demo
  3. 3. ● On mobile, canvas not there yet for us○ 2-3 fps performance○ Differences in touch handling over browsers● Porting not an option○ 30k LOC of JS times two platforms● Idea: Reuse JS version○ Embed JS VM into app, here v8○ Custom code for canvas, AJAX, websocket, ...JS isnt for everything
  4. 4. Android embedding architectureDalvik VM(Java) App (Views, Activities)
  5. 5. Android embedding architectureDalvik VM(Java)v8Engine singletonJNI(C/C++) BGJSContextv8(JS)JS ChartApp (Views, Activities)initializesload andexecuterequiresOther JS files
  6. 6. Android embedding architectureDalvik VM(Java)v8Engine singletonJNI(C/C++) BGJSContextv8(JS)JS ChartBGJSModulesApp (Views, Activities)initializesEjecta + BG(Canvas inOpenGL)register asJS functionsload andexecuteOther JS filesrequires
  7. 7. Android embedding architectureDalvik VM(Java)v8Engine singletonJNI(C/C++) BGJSContextv8(JS)JS ChartBGJSModulesApp (Views, Activities)initializesv8TextureView(GL init, pageflip,touch, ..)addsEjecta + BG(Canvas inOpenGL)register asJS functionsload andexecuteOther JS filesrequires
  8. 8. Android embedding architectureDalvik VM(Java)v8Engine singletonJNI(C/C++) BGJSContextv8(JS)JS ChartAjax Helper(threading, IO, ...)BGJSModulesApp (Views, Activities)initializesv8TextureView(GL init, pageflip,touch, ..)addsAjaxModuleEjecta + BG(Canvas inOpenGL)register asJS functionsload andexecuteAuthModule...Other JS filesrequires
  9. 9. DemoFinger crossing plz.
  10. 10. Lessons learned and end● Embedding a JS VM is a big to epic win○ Performance gain x20 (!)○ Oh, and works on x86 too of course :D● But plan to take some time:○ v8 is great, but steep learning curve.○ Debugging JNI/NDK can be very painful.Thanks for your time.@unverbraucht+Kevin Read: http://gplus.to/unverbrauchtEjectaJS for iOS: http://impactjs.com/ejectaMartins stuff: https://github.com/Tharitgplus.to/unverbraucht

×