{"action":"created","issue":{"url":"https://api.github.com/repos/k3b/APhotoManager/issues/74","repository_url":"https://api.github.com/repos/k3b/APhotoManager","labels_url":"https://api.github.com/repos/k3b/APhotoManager/issues/74/labels{/name}","comments_url":"https://api.github.com/repos/k3b/APhotoManager/issues/74/comments","events_url":"https://api.github.com/repos/k3b/APhotoManager/issues/74/events","html_url":"https://github.com/k3b/APhotoManager/issues/74","id":188006822,"number":74,"title":"Performance improvement suggestion","user":{"login":"struggggle","id":19150666,"avatar_url":"https://avatars.githubusercontent.com/u/19150666?v=3","gravatar_id":"","url":"https://api.github.com/users/struggggle","html_url":"https://github.com/struggggle","followers_url":"https://api.github.com/users/struggggle/followers","following_url":"https://api.github.com/users/struggggle/following{/other_user}","gists_url":"https://api.github.com/users/struggggle/gists{/gist_id}","starred_url":"https://api.github.com/users/struggggle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/struggggle/subscriptions","organizations_url":"https://api.github.com/users/struggggle/orgs","repos_url":"https://api.github.com/users/struggggle/repos","events_url":"https://api.github.com/users/struggggle/events{/privacy}","received_events_url":"https://api.github.com/users/struggggle/received_events","type":"User","site_admin":false},"labels":[{"id":378306205,"url":"https://api.github.com/repos/k3b/APhotoManager/labels/beauty","name":"beauty","color":"fbca04","default":false},{"id":241242198,"url":"https://api.github.com/repos/k3b/APhotoManager/labels/enhancement","name":"enhancement","color":"84b6eb","default":true},{"id":378463096,"url":"https://api.github.com/repos/k3b/APhotoManager/labels/mod%20gallery","name":"mod gallery","color":"c5def5","default":false},{"id":378463627,"url":"https://api.github.com/repos/k3b/APhotoManager/labels/mod%20image%20view","name":"mod image view","color":"c5def5","default":false},{"id":241242201,"url":"https://api.github.com/repos/k3b/APhotoManager/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-11-08T14:33:05Z","updated_at":"2016-11-09T14:11:11Z","closed_at":null,"body":"Dear developers,\r\nI am writing a static code analysis tool to conduct performance analysis for Android apps. I found two violations of bitmap displaying in APhotoManager's code. They could affect performance. \r\n\r\nIn the position of APhotoManager's code:\r\n_de.k3b.android.androFotoFinder.imagedetail.HugeImageLoader.loadImage() (line number: 108)_\r\nbitmap object is created with the invocation of decodeFile(). However, decodeFile() is a slow operation and it is in the UI thread. \r\nAndroid documentation says this: \r\nhttps://developer.android.com/training/displaying-bitmaps/process-bitmap.html\r\n\"The BitmapFactory.decode* methods should not be executed on the main UI thread if the source data is read from disk or a network location (or really any source other than memory).\"\r\nYou can process bitmaps in a background thread using AsyncTask.\r\n\r\nIn the position of APhotoManager's code:\r\n_de.k3b.android.androFotoFinder.gallery.cursor.GalleryCursorAdapterFromArray.getView() (line number: 110)_\r\nloadImage() will be called many times and new bitmap objects will be created continuously. We know that bitmap objects can consume a large amount of memory. This wastes a lot of CPU cycles in decoding and RAM in storing bitmap objects. On low end devices, GC will kick in frequently because of RAM pressure.\r\n\r\nMaybe we can use a memory cache and a disk cache to store the bitmap objects. Then app can reuse them instead of creating new bitmap objects continuously.\r\n\r\nLooking forward to your response and hope this information is useful for you.\r\nThanks.\r\n\r\nReferences: \r\nhttps://developer.android.com/training/displaying-bitmaps/cache-bitmap.html\r\nhttps://www.youtube.com/watch?v=R5ON3iwx78M&index=44&list=PLWz5rJ2EKKc9CBxr3BVjPTPoDPLdPIFCE\r\nhttps://www.youtube.com/watch?v=JkwrNmCwFfA&index=19&list=PLWz5rJ2EKKc9CBxr3BVjPTPoDPLdPIFCE\r\nhttp://developer.android.com/training/articles/perf-anr.html\r\n"},"comment":{"url":"https://api.github.com/repos/k3b/APhotoManager/issues/comments/259423120","html_url":"https://github.com/k3b/APhotoManager/issues/74#issuecomment-259423120","issue_url":"https://api.github.com/repos/k3b/APhotoManager/issues/74","id":259423120,"user":{"login":"struggggle","id":19150666,"avatar_url":"https://avatars.githubusercontent.com/u/19150666?v=3","gravatar_id":"","url":"https://api.github.com/users/struggggle","html_url":"https://github.com/struggggle","followers_url":"https://api.github.com/users/struggggle/followers","following_url":"https://api.github.com/users/struggggle/following{/other_user}","gists_url":"https://api.github.com/users/struggggle/gists{/gist_id}","starred_url":"https://api.github.com/users/struggggle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/struggggle/subscriptions","organizations_url":"https://api.github.com/users/struggggle/orgs","repos_url":"https://api.github.com/users/struggggle/repos","events_url":"https://api.github.com/users/struggggle/events{/privacy}","received_events_url":"https://api.github.com/users/struggggle/received_events","type":"User","site_admin":false},"created_at":"2016-11-09T14:11:11Z","updated_at":"2016-11-09T14:11:11Z","body":"Hello k3b,\r\nIn practical use, I use APhotoManager to browse the photos in the album and it work well (without obvious slow). Thanks for your good work.\r\nThe improvement suggestions are come from the detection results of my static code analysis tool, which is designed to detect whether an app exists some space for performance improvement. So I wish the improvement suggestions can help you improve APhotoManager's performance?  \r\n"}}
{"actor":{"display_login":"struggggle"}}