This document summarizes benchmarks comparing the performance of converting RGB images to grayscale using different technologies on Android: Java, NDK C/C++, Intel IPP library, and JavaScript. The same algorithm was implemented in each technology and run 1000 times on a Galaxy Tab3 tablet. Results showed that the NDK implementation was on average 4x faster than Java and IPP was 13x faster. JavaScript performance varied by browser, with Chrome being slower than Java and Firefox faster. This document provides code samples and details on setting up each benchmark environment.
4. Itjustwasn'tready
Si riferiva a FB su mobile che era web based e stava facendo la prima intervista
“After the company’s continuous stock price drop” (ndr)
http://mashable.com/2012/09/11/mark-zuckerberg-post-ipo-interview/
5. fastbook
http://www.sencha.com/blog/the-making-of-fastbook-an-html5-love-story
fastbook, Sencha’s fb demo client
"... is really promising, but it is running in the “browser”.
When you make an “installable” app, you can only use WebView,
which is a second-class and slower browser."
It's a technology demo that shows what developers can do with HTML5 if they take the
right approach, and use the right frameworks and tools
6. (*)WebApps ● cached
● offline capable
● mobile-webapp-capable
● Homescreen-installed
● hosted app
● packaged app
https://developers.google.com/chrome/apps/
https://developer.mozilla.org/en-US/Apps/Build/installable_apps
secondo alcuni sono una liberazione dai marketplace (i.e. Google Play & AppStore)
secondo alcuni tra l’altro alcune tecnologie vengono ritardate dai produttori per non
perdere il potere che viene dai marketplace
13. Native,NDK
capire quanto possiamo guadagnare in
termini di performance basandoci su
differenti tecnologie
Applicazione
Android NDK
che usa
librerie native
Applicazione
Android Java
per Dalvik
15. Benchmark
In entrambe le applicazioni precedenti una
operazione semplice ma computazionalmente costosa
è fare la conversione in grayscale delle immagini
21. Codice(Java) Java:
void compute(byte[] in, byte[] out) {
for(int i=0, j=0; i< out.length; i++, j+=3)
out[i] =
(byte)(0.299 * in[j] + 0.587 * in[j+1] + 0.114 * in[j+2]);
}
Using FP arithmetics !!
We cannot (at least without asm.js) coherce
numbers to integers in js so we chosen not to
optimize here.
24. Details(IPP) Bundled in BeaconMountain beh … la ‘preview’
http://software.intel.com/en-us/intel-ipp
… ed avete la IPP per android x86 !!!
Scaricate la versione per linux ( la evaluation, or 199$ :( )
Installatela ( vi serve una macchina linux )
Copiate le librerie (*.a) e gli include (*.h)
(32bit statici non-threaded)
28. Codice(js)
var len_out = outb.length;
var i,j;
for(i=0, j=0; i< len_out; i++, j+=3)
outb[i] = (0.299 * inb[j] + 0.587 * inb[j+1] + 0.114 *inb[j+2]);
var buffer_in = new ArrayBuffer(size*3);
var buffer_out = new ArrayBuffer(size);
var inb = new Uint8Array(buffer_in);
var out = new Uint8Array(buffer_out);
31. Details(HAXM) Bundled in BeaconMountain
http://software.intel.com/en-us/android/articles/intel-hardware-
accelerated-execution-manager
cambia la vita con le immagini x86
Attenzione pianta OSX, maverick
installare lo hotfix