Wednesday, June 24, 2020

Being Bad at Coroutines: Part 2 Electric Boogaloo

    Cachify and Highlander recently received updates to 0.0.14 and 0.0.12 respectively and bring with them some changes that should help improve performance. In case you've forgotten, Cachify is a Kotlin coroutine powered implementation of the launch-or-join pattern, and Highlander is a Kotlin coroutine powered implementation of the cancel-then-run pattern. Cachify also implements simple in-memory caching of its results, though this is optional.

    Before, both of these libraries internally relied on a mutex to lock a common piece of data while it was being manipulated - but this mutex lock was actually causing the libraries to be less efficient due to how the CoroutineScope was being manipulated. This has been rectified in the newest versions - Cachify does not treat its entire coroutine flow as the same scope, so it will be able to service more requests in parallel and join them to the running request. Highlander will cancel the old coroutine before entering a new scope, which allows for better transitioning from one job to the next. Do note that when Highlander cancels an old job to begin a new job, it will cancel the underlying CoroutineScope, which means that any code inside of a finally {} block will run when it is replacing jobs. Just something to keep in mind incase you use Highlander as a one-shot single job runner with a try-catch-finally pattern.

FridgeFriend gained a new transparent bottom nav bar which plays nice with the system insets, allowing content to draw underneath the bar. Scrolling is smoother and more animated. You can search any item ever entered into the app, and you can filter out data by things like when you bought it or how soon it expires. You can't install it yet though - as I have still not gotten around to putting it on the store. The curse of the ever lazy developer I suppose. I am working on an Android R compatible way to bring back the geofencing capability without requiring additional permission, though it may not make it into a first release.

One of these days, hopefully soon, I will decide to cut a release for the other apps whether FridgeFriend is ready or not. Hopefully by the time we next meet, they will be updated.

Stay tuned.

========================
Follow pyamsoft around the Web for updates and announcements about the newest applications!
Like what I do?

Send me an email at: pyam.soft@gmail.com
Or find me online at: https://pyamsoft.blogspot.com

Follow my Facebook Page
Check out my code on GitHub
=========================