of bytes cycles and battery life
Download
Skip this Video
Download Presentation
Of Bytes, Cycles and Battery Life

Loading in 2 Seconds...

play fullscreen
1 / 31

Of Bytes, Cycles and Battery Life - PowerPoint PPT Presentation


  • 63 Views
  • Uploaded on

Of Bytes, Cycles and Battery Life. Who am I?. [2]. [1]. @ badlogicgames http:// www.badlogicgames.com. What i‘ll talk about. How to reduce your APK size Memory Analysis Tools Performance Analysis Tools. How to reduce your APK size. Reduce asset size p ngcrush your PNGs [3]

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Of Bytes, Cycles and Battery Life' - yana


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
who am i
Who am I?

[2]

[1]

@badlogicgames

http://www.badlogicgames.com

what i ll talk about
Whati‘lltalkabout
  • Howtoreduceyour APK size
  • Memory Analysis Tools
  • Performance Analysis Tools
how to reduce your apk size
Howtoreduceyour APK size
  • Reduceassetsize
    • pngcrushyour PNGs [3]
    • SVG (YMMV) [4]
    • lower bit-rates foraudio
  • Reducecodesize
    • Remove unnecessarydependencies!
    • Proguard, for Class files [5] [6]
    • Dexguard, forDexfiles [7]
but i can t reduce my apk size
„But i can‘treducemy APK size“
  • Multiple-APKs tothe „rescue“ [8]
    • One APK per screendensity
    • One APK per texturecompressionalgorithm
    • Use Google Play filters
    • EasierwithnewAndroidGradlebuildsystem
  • APK Expansion files [9]
    • hostedby Google
  • Roll yourown „Expansion files“
    • Avoidifyoucan!
memory analysis tools
Memory Analysis Tools
  • „But wehave a GarbageCollector!“
    • Youcan still „leak“ memory
    • Nastystaticvarsreferencingunusedobjects
    • Hidden objectreferences
    • Native memoryallocatedby Java classes
  • Ifyouwritegames, GC killsyoursteady framerate
hprof eclipse mat 11
HPROF/Eclipse MAT [11]
  • Select theprocess
  • Click
  • Save to a locationofyourchoice
  • Convertto „real“ HPROF file
  • Open in Eclipse MAT [12]
performance analysis tools
Performance Analysis Tools
  • Why do wewanttoanalyse?
    • Jerkyanimations
    • Do less, conservebattery
    • Betteruser Experience
  • What do wewanttoanalyse?
    • Time spent in Java code
    • Time spent in Native code
    • Time spentdrawingstuff
before we start
Beforewestart...
  • Never usetheemulator!
    • Ever, thinkofthekittens
  • Identifyhotspots in yourapp, not in microbenchmarks
  • Onlyspend time ifyouhave a real problem
java profilers
Java Profilers
  • DDMS
    • Quitecapablemethodlevelprofiler
    • Goodenoughfor 99% ofusecases
    • Works withanyAndroidversion
  • 4.1+ Profilingtools
    • Systrace [13], More powerful, also tracks OS calls
      • Needs rootandAndroid 4.1+
    • We‘llcheck out thegraphicalpartslater
slide16
DDMS
  • Start app
  • Navigatetoproblematicactivity, hit
  • Wait a bit, hit
  • View profilingdata
    • Ignore absolute time, onlycarefor relative timings
    • Ignore trivial getters/setters, instrumentationmesseswithtimings
native code profilers
Native Code Profilers
  • Android NDK Profiler [14]
    • Not an official NDK tool
    • Setup a bitinvolved
  • Device specific CPU profilers
    • NVIDIA Nsight [15], ...
  • Roll yourown
    • Instrument manually
    • Track down hotspots
graphics profilers
Graphics Profilers
  • What do weanalyse?
    • Overdraw, yourbiggestenemy
    • Draw calls, yoursecondbiggestenemy
      • Use DDMS/systrace
    • Relatedtomemory
      • Textures on VRAM (whichisusually RAM)
      • Bitmaps in RAM
graphics profilers1
Graphics Profilers
  • 4.1+ Profilingtools
  • GPU VendorSpecific
    • NVIDIA [16], Qualcomm [17], Imagination Technologies [18]
    • Outside ofscopeofthistalk
visualize overdraw
VisualizeOverdraw
  • Normal Color – 0 Overdraw
  • Blue – 1x Overdraw
  • Green – 2x Overdraw
  • Light Red– 3x Overdraw
  • Dark Red– +4x Overdraw
visualize overdraw1
VisualizeOverdraw
  • Hierarchy View [20]
  • Window -> Open Perspective -> Other...
visualize overdraw3
VisualizeOverdraw
  • Tracer for OpenGL [21]
  • Window -> Open Perspective -> Other ...
  • Click
  • Enterpackagename
  • Wait
closing words
Closing Words
  • So muchtotell, so little time
  • See Dalvik Performance Tips [22]
  • Read all references
    • Yourusers will thankyouforexcellentbatterylifeandbuttery smooth UIs
slide29
FIN

Thanksfor Listening

Questions?

references
References

[1] http://www.amazon.com/Beginning-Android-Games-Mario-Zechner/dp/1430246774

[2] http://libgdx.badlogicgames.com/

[3] http://pmt.sourceforge.net/pngcrush/

[4] https://code.google.com/p/svg-android/

[5] http://developer.android.com/tools/help/proguard.html

[6] http://proguard.sourceforge.net/index.html

[7] http://www.saikoa.com/dexguard

[8] http://developer.android.com/google/play/publishing/multiple-apks.html

[9] http://developer.android.com/google/play/expansion-files.html

[10] http://developer.android.com/tools/debugging/ddms.html

[11] http://android-developers.blogspot.co.at/2011/03/memory-analysis-for-android.html

references1
References

[12] http://www.eclipse.org/mat/

[13] http://developer.android.com/tools/help/systrace.html

[14] https://code.google.com/p/android-ndk-profiler/

[15] http://www.nvidia.com/object/nsight.html

[16] https://developer.nvidia.com/tegra-profiler

[17] https://developer.qualcomm.com/mobile-development/mobile-technologies/gaming-graphics-optimization-adreno/tools-and-resources

[18] http://www.imgtec.com/powervr/insider/sdkdownloads/

[19] http://www.curious-creature.org/2012/12/01/android-performance-case-study/

[20] http://developer.android.com/tools/debugging/debugging-ui.html

[21] http://developer.android.com/tools/help/gltracer.html

[22] http://developer.android.com/training/articles/perf-tips.html

ad