alunny
Joined 17 years ago
Joined 17 years ago
Again, "such significant performance gains for our users" is just FUD when you're talking about arbitrary benchmarks. An app built using Forge and PhoneGap, providing the same functionality, with the same UI layer, would be a much better measure of that. I'd be happy to be proven wrong.
This is a silly benchmark - there is absolutely no reason you would put 1000 calls at once, sequential or parallel, across this sort of bridge in a real app. You probably shouldn't be calling any JavaScript API in a client-side app 1000 times at once.
The bridge in PhoneGap Android probably is slower than the one in Forge but
1) that's a tradeoff the PhoneGap devs were willing to make for wider compatibility, support for older devices, and isolation from the bizarre Android WebKit bugs that crop up in every release.
2) synthetic benchmarks aside, there's no indication this would affect the usability of the app.
Take the camera example in the article. A PhoneGap call (judging from the graphs) takes about 14ms, a Forge call about 3ms. That's for the entire round trip (JavaScript -> Native -> JavaScript), so divide each in half for each side of the trip.
With PhoneGap: * first half of the trip (7ms) * Android presents Camera activity, user picks a photo, Android returns control to original app (say, 500ms, very conservatively) * second half of the trip (7ms) = 514ms
With Forge: * first half of the trip (1.5ms) * Android presents Camera activity, user picks a photo, Android returns control to original app (500ms) * second half of the trip (1.5ms) = 503ms
This is much closer to a real-world use case - and the calls to native APIs entirely dominate the time spent on the bridge.
More knowledgable people than myself discuss it on this es-discuss thread: http://www.mail-archive.com/[email protected]/msg06142....
There is a Harmony proposal for a "set prototype of operator" that would solve this problem; instead of writing:
var newObj = {__proto__: OldObject, id: 5}
You would write: var newObj = OldObject <| { id: 5 }
Detailed here:
http://wiki.ecmascript.org/doku.php?id=harmony:proto_operato...but chart.apis.google.com (which Google formerly used) does not: https://chart.apis.google.com/chart?chs=150x150&cht=qr...
Turns out I was looking at some outdated docs. Thanks!
[EDIT] I was mistaken, see andrewjshults's reply.
edit: oh, you probably mean the language name. Again, JavaScript is the correct formatting, even if it looks silly to most eyes.
At a lower level of abstractions are the middleware layers Connect http://github.com/extjs/Connect and JSGI http://github.com/kriszyp/jsgi-node