Learning Android Development

Speed Up Mandelbrot Drawing on Android Jetpack Compose

Using SurfaceView, Kotlin Coroutine Channel, and Bitmap Operation to Speedup Mandelbrot Drawing on Android

Image by socialtrendspr0 on Pixarbay

If you have studied computer science parallel processing before, coding and experiment drawing Mandelbrot is an interesting assignment to explore how we can use parallel processing to speed up the drawing.

With that, I explore on Android Jetpack Compose and see how the speed is. Below is some experiment result I got and how I go about speeding it up.

It improves a 900-seconds drawing to 4 seconds, and then further improves to instant incremental update.

What is Mandelbrot

Before we get into those experiments, below is an over-simplistic description from myself. It has a computation on every single pixel to be drawn, that has similar yet slightly different computation, that can be parallelized to speed up.

It has a mathematical computation that I’m not going to code myself, so I refer to this Kotlin code here and make it work on Android.

The drawing result as below

--

--