SlideShare une entreprise Scribd logo
1  sur  34
Télécharger pour lire hors ligne
Go Native? 
Benchmark test su dispositivi x86: 
Java, NDK, IPP e TBB 
Francesca Tosi Alberto Mancini 
francesca@jooink.com alberto@jooink.com
Francesca 
Web and mobile developer 
software engineer and architect 
with a passion for clean code 
and fine tuned details 
Intel Software Innovator 
francesca@jooink.com 
@francescatosi 
+FrancescaTosi 
www.jooink.com
Alberto 
Software Developer 
(Web & Mobile); 
Linux Sysadmin 
DevOp. 
Intel Software Innovator 
alberto@jooink.com 
+AlbertoMancini 
www.jooink.com
Why NDK? 
The NDK is a toolset that allows you to implement 
parts of your app using native-code languages such 
as C and C++. 
You should understand that the NDK will not benefit 
most apps. As a developer, you need to balance its 
benefits against its drawbacks. 
!!NDK is not always the right choice http://goo.gl/LrmM5G
Why NDK? 
While developing expensive (from the computational 
point of view) apps 
→ we must optmize 
We decided to test the performance of NDK.
Browser based computation 
● Augmented Reality
Browser based computation 
● Augmented Reality 
● Interest Point detection
Browser based computation 
● Augmented Reality 
● Interest Point detection 
● Computer Vision & 
Image Recognition
Performance 
new mobile_app( ... ) 
→ system & tools evaluation 
→ benchmark test:Image RGB2GrayScale conversion
Performance 
Our choice for benchmarks: 
→ Pure Java 
→ NDK (C/C++) 
→ Intel Performance Primitives (IPP) 
→ Threading Building Blocks (TBB)
Performance 
Our choice for benchmark: 
→ Pure Java 
→ NDK (C/C++) 
→ Intel Performance Primitives (IPP) 
→ Threading Building Blocks (TBB) 
Intel INDE
Performance 
Our choice for benchmark: 
→ Pure Java 
→ NDK (C/C++) 
→ Intel Performance Primitives (IPP) 
→ Threading Building Blocks (TBB) 
Intel Beacon 
Mountain 
goo.gl/RWvxU6
Dispositivi di test 
● Galaxy Tab 3 
● DELL Venue 8 
● Lenovo K900
Dispositivi di test 
Galaxy Tab 3 
● Intel atom cpu z2560 
● 2 core - 1.60 GHz 
● Android 4.4.2 
● Architettura i686
Dispositivi di test 
DELL Venue 8 
● Intel atom cpu z2580 
● 2 core - 2 GHz 
● Android 4.2.2 
● 2 GB RAM
Dispositivi di test 
Lenovo K900 
● Intel atom cpu z2580 
● 2 core - 2 GHz 
● Android 4.2.2 
● 2 GB RAM
Image RGB2Grayscale 
RGB 
jfloat[1024*1024*3] 
gray 
jfloat[1024*1024] 
1 
2 
3 
0.299*R+0.587*G+0.114*B → Y 
Average on 10K runs
Image RGB2Grayscale 
Java 
void compute(float[] in, float[] out) { 
for(int i=0, j=0; i< out.length; i++, j+=3) 
out[i] = (0.299 * in[j] + 0.587 * in[j+1] + 0.114 * in 
[j+2]); 
}
Image RGB2Grayscale 
NDK 
void JNICALL … jfloatArray in, jfloatArray out) { 
jsize len_out = (*env)->GetArrayLength(env, out); 
... 
jfloat *body_out = (*env)->GetFloatArrayElements(env, out, 0); 
for(i=0, j=0; i< len_out; i++, j+=3) 
body_out[i] = (jfloat)(0.299 * body_in[j] + … ); 
(*env)->ReleaseFloatArrayElements(env, in, body_in, 0); 
... 
}
Image RGB2Grayscale 
IPP 
IppiSize srcRoi = { 1024, 1024 }; 
Ipp32f* pSrc = body_in; 
Ipp32f* pDst = body_out; 
ippiRGBToGray_32f_C3C1R(pSrc ,1024, pDst, 1024, srcRoi);
Image RGB2Grayscale 
TBB 
tbb::parallel_invoke( 
[pSrc,pDst] { 
IppiSize srcRoi = { 1024, 512 }; 
ippiRGBToGray_32f_C3C1R(..., srcRoi); 
}, 
[pSrc,pDst] { 
IppiSize srcRoi = { 1024, 512 }; 
Ipp32f* pSrcShifted = pSrc+3*(1024*512); 
Ipp32f* pDstShifted = pDst+(1024*512); 
ippiRGBToGray_32f_C3C1R(...); 
});
Intel INDE 
Integrated 
Native 
Development 
Experience 
INDE is a cross-platform suite 
that provides developers with 
tools, support, integration and 
updates to create high-performance 
C++/Java 
applications.
Intel INDE 
Integrated 
Native 
Development 
Experience 
→ download 
https://software.intel.com/en-us/intel-inde 
→ integrates with: 
- Android Studio 
- Eclipse 
- Ms Visual Studio (*)
Intel INDE 
Integrated 
Native 
Development 
Experience
Intel INDE 
Integrated 
Native 
Development 
Experience 
→ Intel HAXM 
The Intel Hardware Accelerated 
Execution Manager is an 
hardware-assisted virtualization 
engine (hypervisor) to speed up 
Android app emulation.
Intel INDE 
Integrated 
Native 
Development 
Experience 
→ Intel C++ compiler for Android
Intel IPP 
Integrated Performance Primitives 
Extensive Library of higly optimized (Intel SSE, Intel AVX) 
software functions for: 
- multimedia 
- data processing 
- communication
Intel IPP 
Integrated Performance Primitives 
Components: 
- Signal Processing (filtering, transform) 
- Image Processing (color conversion, wavelet transforms, computer vision) 
- Small Matrices and Rendering (matrix algebra, Eigen problem) 
- Cryptografy (RSA, DSA, prime & pseudorandom number generation)
Intel TBB 
Threading Bulding Blocks 
Open source project (www.threadingbuilingblocks.org) 
Let’s you easly write parallel C++ programs that takes 
full advantage of multicore performance, that are 
portable & composable
Alberto Mancini
Coding time 
Let’s view some code!
Results 
handmade C 
50% 
slower than 
TBB+IPP
Results 
Native/C with 
IPP & TBB 
(4 threads) 
3x 
faster than 
pure java
That’s All !! 
Francesca Tosi 
R&D at Jooink Team 
francesca@jooink.com 
Alberto Mancini 
Dev at Jooink Team 
alberto@jooink.com

Contenu connexe

Tendances

Android OpenGL ES remote rendering 蕭從恩
Android OpenGL ES remote rendering 蕭從恩Android OpenGL ES remote rendering 蕭從恩
Android OpenGL ES remote rendering 蕭從恩
Tsung-en Hsiao
 
[02][cuda c 프로그래밍 소개] gateau intro to_cuda_c
[02][cuda c 프로그래밍 소개] gateau intro to_cuda_c[02][cuda c 프로그래밍 소개] gateau intro to_cuda_c
[02][cuda c 프로그래밍 소개] gateau intro to_cuda_c
laparuma
 
PDK Support Slides from Appcelerator/Palm WWDC Party, June 9th, 2010
PDK Support Slides from Appcelerator/Palm WWDC Party, June 9th, 2010PDK Support Slides from Appcelerator/Palm WWDC Party, June 9th, 2010
PDK Support Slides from Appcelerator/Palm WWDC Party, June 9th, 2010
Ben Combee
 

Tendances (20)

Android OpenGL ES remote rendering 蕭從恩
Android OpenGL ES remote rendering 蕭從恩Android OpenGL ES remote rendering 蕭從恩
Android OpenGL ES remote rendering 蕭從恩
 
Newbie’s guide to_the_gpgpu_universe
Newbie’s guide to_the_gpgpu_universeNewbie’s guide to_the_gpgpu_universe
Newbie’s guide to_the_gpgpu_universe
 
GPU Ecosystem
GPU EcosystemGPU Ecosystem
GPU Ecosystem
 
Developing a NodeBot using Intel XDK IoT Edition
Developing a NodeBot using Intel XDK IoT EditionDeveloping a NodeBot using Intel XDK IoT Edition
Developing a NodeBot using Intel XDK IoT Edition
 
Away3D update
Away3D updateAway3D update
Away3D update
 
Remote Graphical Rendering
Remote Graphical RenderingRemote Graphical Rendering
Remote Graphical Rendering
 
Optimizing Total War*: WARHAMMER II
Optimizing Total War*: WARHAMMER IIOptimizing Total War*: WARHAMMER II
Optimizing Total War*: WARHAMMER II
 
NVIDIA 深度學習教育機構 (DLI): Neural network deployment
NVIDIA 深度學習教育機構 (DLI): Neural network deploymentNVIDIA 深度學習教育機構 (DLI): Neural network deployment
NVIDIA 深度學習教育機構 (DLI): Neural network deployment
 
Overview of the Intel® Internet of Things Developer Kit
Overview of the Intel® Internet of Things Developer KitOverview of the Intel® Internet of Things Developer Kit
Overview of the Intel® Internet of Things Developer Kit
 
Making Open Source Hardware IoT with Raspberry Pi
Making Open Source Hardware IoT with Raspberry PiMaking Open Source Hardware IoT with Raspberry Pi
Making Open Source Hardware IoT with Raspberry Pi
 
Remote Android Rendering
Remote Android RenderingRemote Android Rendering
Remote Android Rendering
 
Accelerate Large-Scale Inverse Kinematics with the Intel® Distribution of Ope...
Accelerate Large-Scale Inverse Kinematics with the Intel® Distribution of Ope...Accelerate Large-Scale Inverse Kinematics with the Intel® Distribution of Ope...
Accelerate Large-Scale Inverse Kinematics with the Intel® Distribution of Ope...
 
[02][cuda c 프로그래밍 소개] gateau intro to_cuda_c
[02][cuda c 프로그래밍 소개] gateau intro to_cuda_c[02][cuda c 프로그래밍 소개] gateau intro to_cuda_c
[02][cuda c 프로그래밍 소개] gateau intro to_cuda_c
 
How to Choose Mobile Workstation? VR Ready
How to Choose Mobile Workstation? VR ReadyHow to Choose Mobile Workstation? VR Ready
How to Choose Mobile Workstation? VR Ready
 
OpenACC Monthly Highlights- December
OpenACC Monthly Highlights- DecemberOpenACC Monthly Highlights- December
OpenACC Monthly Highlights- December
 
It Doesn't Have to Be Hard: How to Fix Your Performance Woes
It Doesn't Have to Be Hard: How to Fix Your Performance WoesIt Doesn't Have to Be Hard: How to Fix Your Performance Woes
It Doesn't Have to Be Hard: How to Fix Your Performance Woes
 
What is Aquila Software Architecture for Cognitive Robotics?
What is Aquila Software Architecture for Cognitive Robotics?What is Aquila Software Architecture for Cognitive Robotics?
What is Aquila Software Architecture for Cognitive Robotics?
 
Spooky House Studios: Game development for smartwatches. Challenges and solut...
Spooky House Studios: Game development for smartwatches. Challenges and solut...Spooky House Studios: Game development for smartwatches. Challenges and solut...
Spooky House Studios: Game development for smartwatches. Challenges and solut...
 
PDK Support Slides from Appcelerator/Palm WWDC Party, June 9th, 2010
PDK Support Slides from Appcelerator/Palm WWDC Party, June 9th, 2010PDK Support Slides from Appcelerator/Palm WWDC Party, June 9th, 2010
PDK Support Slides from Appcelerator/Palm WWDC Party, June 9th, 2010
 
How to Make Hand Detector on Native Activity with OpenCV
How to Make Hand Detector on Native Activity with OpenCVHow to Make Hand Detector on Native Activity with OpenCV
How to Make Hand Detector on Native Activity with OpenCV
 

Similaire à Go native benchmark test su dispositivi x86: java, ndk, ipp e tbb

Android on IA devices and Intel Tools
Android on IA devices and Intel ToolsAndroid on IA devices and Intel Tools
Android on IA devices and Intel Tools
Xavier Hallade
 
“Intel Video AI Box—Converging AI, Media and Computing in a Compact and Open ...
“Intel Video AI Box—Converging AI, Media and Computing in a Compact and Open ...“Intel Video AI Box—Converging AI, Media and Computing in a Compact and Open ...
“Intel Video AI Box—Converging AI, Media and Computing in a Compact and Open ...
Edge AI and Vision Alliance
 

Similaire à Go native benchmark test su dispositivi x86: java, ndk, ipp e tbb (20)

Intel ndk - a few Benchmarks
Intel ndk - a few BenchmarksIntel ndk - a few Benchmarks
Intel ndk - a few Benchmarks
 
Android on IA devices and Intel Tools
Android on IA devices and Intel ToolsAndroid on IA devices and Intel Tools
Android on IA devices and Intel Tools
 
Deep Learning Edge
Deep Learning Edge Deep Learning Edge
Deep Learning Edge
 
Android on Intel platforms : current state, near-future, future & developers ...
Android on Intel platforms : current state, near-future, future & developers ...Android on Intel platforms : current state, near-future, future & developers ...
Android on Intel platforms : current state, near-future, future & developers ...
 
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015
 
Transparent GPU Exploitation for Java
Transparent GPU Exploitation for JavaTransparent GPU Exploitation for Java
Transparent GPU Exploitation for Java
 
[University] Capstone Design Project 2 (SAIOT)
[University] Capstone Design Project 2 (SAIOT)[University] Capstone Design Project 2 (SAIOT)
[University] Capstone Design Project 2 (SAIOT)
 
Intel IoT Edge Computing 在 AI 領域的應用與商機
Intel IoT Edge Computing 在 AI 領域的應用與商機Intel IoT Edge Computing 在 AI 領域的應用與商機
Intel IoT Edge Computing 在 AI 領域的應用與商機
 
Denis Nagorny - Pumping Python Performance
Denis Nagorny - Pumping Python PerformanceDenis Nagorny - Pumping Python Performance
Denis Nagorny - Pumping Python Performance
 
“Intel Video AI Box—Converging AI, Media and Computing in a Compact and Open ...
“Intel Video AI Box—Converging AI, Media and Computing in a Compact and Open ...“Intel Video AI Box—Converging AI, Media and Computing in a Compact and Open ...
“Intel Video AI Box—Converging AI, Media and Computing in a Compact and Open ...
 
Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!
 
Android ndk: Entering the native world
Android ndk: Entering the native worldAndroid ndk: Entering the native world
Android ndk: Entering the native world
 
Developing Multi-OS Native Mobile Applications with Intel INDE
Developing Multi-OS Native Mobile Applications with Intel INDEDeveloping Multi-OS Native Mobile Applications with Intel INDE
Developing Multi-OS Native Mobile Applications with Intel INDE
 
Python Data Science and Machine Learning at Scale with Intel and Anaconda
Python Data Science and Machine Learning at Scale with Intel and AnacondaPython Data Science and Machine Learning at Scale with Intel and Anaconda
Python Data Science and Machine Learning at Scale with Intel and Anaconda
 
Accelerate Your IoT and Robotics Development Using Web Technology and Apache ...
Accelerate Your IoT and Robotics Development Using Web Technology and Apache ...Accelerate Your IoT and Robotics Development Using Web Technology and Apache ...
Accelerate Your IoT and Robotics Development Using Web Technology and Apache ...
 
Faster deep learning solutions from training to inference - Michele Tameni - ...
Faster deep learning solutions from training to inference - Michele Tameni - ...Faster deep learning solutions from training to inference - Michele Tameni - ...
Faster deep learning solutions from training to inference - Michele Tameni - ...
 
The Intel NUC 12 Extreme Kit is a compact workstation that can handle compute...
The Intel NUC 12 Extreme Kit is a compact workstation that can handle compute...The Intel NUC 12 Extreme Kit is a compact workstation that can handle compute...
The Intel NUC 12 Extreme Kit is a compact workstation that can handle compute...
 
Smartphone++
Smartphone++Smartphone++
Smartphone++
 
Building CI_CD for Mobile Development.pptx
Building CI_CD for Mobile Development.pptxBuilding CI_CD for Mobile Development.pptx
Building CI_CD for Mobile Development.pptx
 
Reducing Deep Learning Integration Costs and Maximizing Compute Efficiency| S...
Reducing Deep Learning Integration Costs and Maximizing Compute Efficiency| S...Reducing Deep Learning Integration Costs and Maximizing Compute Efficiency| S...
Reducing Deep Learning Integration Costs and Maximizing Compute Efficiency| S...
 

Plus de JooinK

Web&mobile - 4 ottobre 2012
Web&mobile  - 4 ottobre 2012Web&mobile  - 4 ottobre 2012
Web&mobile - 4 ottobre 2012
JooinK
 
JooinK Presentation
JooinK PresentationJooinK Presentation
JooinK Presentation
JooinK
 

Plus de JooinK (10)

(Js) Export your own WebGL Viewer
(Js) Export your own WebGL Viewer(Js) Export your own WebGL Viewer
(Js) Export your own WebGL Viewer
 
Power-up your mobile & web App with WebRTC
Power-up your mobile & web App with WebRTCPower-up your mobile & web App with WebRTC
Power-up your mobile & web App with WebRTC
 
DIY: Computer Vision with GWT.
DIY: Computer Vision with GWT.DIY: Computer Vision with GWT.
DIY: Computer Vision with GWT.
 
Javascript as a target language - GWT KickOff - Part 2/2
Javascript as a target language - GWT KickOff - Part 2/2Javascript as a target language - GWT KickOff - Part 2/2
Javascript as a target language - GWT KickOff - Part 2/2
 
Javascript as a target language - GWT kickoff - part1/2
Javascript as a target language - GWT kickoff - part1/2Javascript as a target language - GWT kickoff - part1/2
Javascript as a target language - GWT kickoff - part1/2
 
WebRTC ... GWT & in-browser computation
WebRTC ... GWT & in-browser computationWebRTC ... GWT & in-browser computation
WebRTC ... GWT & in-browser computation
 
Augmented experience: Augmented Reality
Augmented experience: Augmented RealityAugmented experience: Augmented Reality
Augmented experience: Augmented Reality
 
JooinK - DevFest Piemonte 2013
JooinK - DevFest Piemonte 2013JooinK - DevFest Piemonte 2013
JooinK - DevFest Piemonte 2013
 
Web&mobile - 4 ottobre 2012
Web&mobile  - 4 ottobre 2012Web&mobile  - 4 ottobre 2012
Web&mobile - 4 ottobre 2012
 
JooinK Presentation
JooinK PresentationJooinK Presentation
JooinK Presentation
 

Dernier

Dernier (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 

Go native benchmark test su dispositivi x86: java, ndk, ipp e tbb

  • 1. Go Native? Benchmark test su dispositivi x86: Java, NDK, IPP e TBB Francesca Tosi Alberto Mancini francesca@jooink.com alberto@jooink.com
  • 2. Francesca Web and mobile developer software engineer and architect with a passion for clean code and fine tuned details Intel Software Innovator francesca@jooink.com @francescatosi +FrancescaTosi www.jooink.com
  • 3. Alberto Software Developer (Web & Mobile); Linux Sysadmin DevOp. Intel Software Innovator alberto@jooink.com +AlbertoMancini www.jooink.com
  • 4. Why NDK? The NDK is a toolset that allows you to implement parts of your app using native-code languages such as C and C++. You should understand that the NDK will not benefit most apps. As a developer, you need to balance its benefits against its drawbacks. !!NDK is not always the right choice http://goo.gl/LrmM5G
  • 5. Why NDK? While developing expensive (from the computational point of view) apps → we must optmize We decided to test the performance of NDK.
  • 6. Browser based computation ● Augmented Reality
  • 7. Browser based computation ● Augmented Reality ● Interest Point detection
  • 8. Browser based computation ● Augmented Reality ● Interest Point detection ● Computer Vision & Image Recognition
  • 9. Performance new mobile_app( ... ) → system & tools evaluation → benchmark test:Image RGB2GrayScale conversion
  • 10. Performance Our choice for benchmarks: → Pure Java → NDK (C/C++) → Intel Performance Primitives (IPP) → Threading Building Blocks (TBB)
  • 11. Performance Our choice for benchmark: → Pure Java → NDK (C/C++) → Intel Performance Primitives (IPP) → Threading Building Blocks (TBB) Intel INDE
  • 12. Performance Our choice for benchmark: → Pure Java → NDK (C/C++) → Intel Performance Primitives (IPP) → Threading Building Blocks (TBB) Intel Beacon Mountain goo.gl/RWvxU6
  • 13. Dispositivi di test ● Galaxy Tab 3 ● DELL Venue 8 ● Lenovo K900
  • 14. Dispositivi di test Galaxy Tab 3 ● Intel atom cpu z2560 ● 2 core - 1.60 GHz ● Android 4.4.2 ● Architettura i686
  • 15. Dispositivi di test DELL Venue 8 ● Intel atom cpu z2580 ● 2 core - 2 GHz ● Android 4.2.2 ● 2 GB RAM
  • 16. Dispositivi di test Lenovo K900 ● Intel atom cpu z2580 ● 2 core - 2 GHz ● Android 4.2.2 ● 2 GB RAM
  • 17. Image RGB2Grayscale RGB jfloat[1024*1024*3] gray jfloat[1024*1024] 1 2 3 0.299*R+0.587*G+0.114*B → Y Average on 10K runs
  • 18. Image RGB2Grayscale Java void compute(float[] in, float[] out) { for(int i=0, j=0; i< out.length; i++, j+=3) out[i] = (0.299 * in[j] + 0.587 * in[j+1] + 0.114 * in [j+2]); }
  • 19. Image RGB2Grayscale NDK void JNICALL … jfloatArray in, jfloatArray out) { jsize len_out = (*env)->GetArrayLength(env, out); ... jfloat *body_out = (*env)->GetFloatArrayElements(env, out, 0); for(i=0, j=0; i< len_out; i++, j+=3) body_out[i] = (jfloat)(0.299 * body_in[j] + … ); (*env)->ReleaseFloatArrayElements(env, in, body_in, 0); ... }
  • 20. Image RGB2Grayscale IPP IppiSize srcRoi = { 1024, 1024 }; Ipp32f* pSrc = body_in; Ipp32f* pDst = body_out; ippiRGBToGray_32f_C3C1R(pSrc ,1024, pDst, 1024, srcRoi);
  • 21. Image RGB2Grayscale TBB tbb::parallel_invoke( [pSrc,pDst] { IppiSize srcRoi = { 1024, 512 }; ippiRGBToGray_32f_C3C1R(..., srcRoi); }, [pSrc,pDst] { IppiSize srcRoi = { 1024, 512 }; Ipp32f* pSrcShifted = pSrc+3*(1024*512); Ipp32f* pDstShifted = pDst+(1024*512); ippiRGBToGray_32f_C3C1R(...); });
  • 22. Intel INDE Integrated Native Development Experience INDE is a cross-platform suite that provides developers with tools, support, integration and updates to create high-performance C++/Java applications.
  • 23. Intel INDE Integrated Native Development Experience → download https://software.intel.com/en-us/intel-inde → integrates with: - Android Studio - Eclipse - Ms Visual Studio (*)
  • 24. Intel INDE Integrated Native Development Experience
  • 25. Intel INDE Integrated Native Development Experience → Intel HAXM The Intel Hardware Accelerated Execution Manager is an hardware-assisted virtualization engine (hypervisor) to speed up Android app emulation.
  • 26. Intel INDE Integrated Native Development Experience → Intel C++ compiler for Android
  • 27. Intel IPP Integrated Performance Primitives Extensive Library of higly optimized (Intel SSE, Intel AVX) software functions for: - multimedia - data processing - communication
  • 28. Intel IPP Integrated Performance Primitives Components: - Signal Processing (filtering, transform) - Image Processing (color conversion, wavelet transforms, computer vision) - Small Matrices and Rendering (matrix algebra, Eigen problem) - Cryptografy (RSA, DSA, prime & pseudorandom number generation)
  • 29. Intel TBB Threading Bulding Blocks Open source project (www.threadingbuilingblocks.org) Let’s you easly write parallel C++ programs that takes full advantage of multicore performance, that are portable & composable
  • 31. Coding time Let’s view some code!
  • 32. Results handmade C 50% slower than TBB+IPP
  • 33. Results Native/C with IPP & TBB (4 threads) 3x faster than pure java
  • 34. That’s All !! Francesca Tosi R&D at Jooink Team francesca@jooink.com Alberto Mancini Dev at Jooink Team alberto@jooink.com