-
Notifications
You must be signed in to change notification settings - Fork 18
put disk access into background thread? #12
base: master
Are you sure you want to change the base?
Conversation
put json loading into background thread.
put picture save into background thread.
put bitmap decoding into background thread.
put bitmap decoding into background.
|
I sent this pr several days ago. Any idea/comments? |
|
@yulin2 Sorry for the delay, Github didn't seem to notify me for some reason so never noticed your PR! Looks ok so far, have you noticed any performance increases from this? I'll do some tests this evening. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing import for Bitmap
the two async task leads to races on mPhotos field
|
Thanks for the reply. I didn't measure performance increase from these refactorings. I apply them based Android docs' suggestion: blocking I/O calls (db, disk, bitmap decode) should be in background thread. I manually tested the changes but didn't get that exception before. That exception is due to data races on "mPhotos" field. Sorry for the missing import and final keyword. It's because I typed and committed via the Github web interface so I miss them. Now I added them. I may also create a cleaner pr if you think the changes are ok. |
Hi, I'm doing research on performance for Android apps. I found some event handlers access disk (read/write files, decode bitmap) from UI thread, but Android docs suggest us to avoid such blocking calls in UI thread. Do they lead to any responsiveness issues?
I tried to refactoring by putting them into background tasks. Looking forward to see your comments.