tuyndv / mytracks

Automatically exported from code.google.com/p/mytracks
0 stars 0 forks source link

Avoid expensive drawing objects allocations during draw operations(preallocate and reuse instead) #1482

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I am a fan of MyTracks, and recently I am writing a static code analysis tool 
to conduct performance analysis for Android apps. I found drawing object 
creation in MyTracks's code. It could make UI appear sluggish.

As suggested by Android Developers,"Creating objects ahead of time is an 
important optimization. Views are redrawn very frequently, and many drawing 
objects require expensive initialization. Creating drawing objects within your 
onDraw() method significantly reduces performance and can make your UI appear 
sluggish."

We found the violations in this class:
com.google.android.apps.mytracks.ChartView

You may find more useful information in this references: 
http://developer.android.com/training/custom-views/custom-drawing.html

Original issue reported on code.google.com by winson...@gmail.com on 24 Mar 2014 at 8:48

GoogleCodeExporter commented 9 years ago
Thanks for the suggestion.

Original comment by jshih@google.com on 1 Apr 2014 at 10:38