yeungkc
08/13/2021, 4:33 PMDominaezzz
08/13/2021, 4:49 PMyeungkc
08/13/2021, 4:52 PMDominaezzz
08/13/2021, 4:52 PMDominaezzz
08/13/2021, 4:53 PMIgor Demin
08/13/2021, 4:54 PMwith a CPU usage of around 25%.We update animation on every vsync signal.
withFrameNanos
ticks every 16.7ms on 60hz monitor, and we also have an issue on some Linux machines where vsync is disabled - frames produced as fast as possible.
So one of the steps to optimize it - is to reduce animation updates (gif animations can have a slower rate, for example every 50ms).
Also, not sure, but maybe codec.readPixels
is too heavy. Worth to try to cache frames, and see how it helps.
Also after caching, it is worth to call bitmap.setImmutable()
. That can significally increase performance, as Bitmap
can be uploaded to GPU memory only once.yeungkc
08/13/2021, 4:54 PMDominaezzz
08/13/2021, 4:54 PMDominaezzz
08/13/2021, 4:54 PMyeungkc
08/13/2021, 5:01 PMhttps://jackrusher.com/images/journal/what-does-it-mean-to-buy-a-gif/nyan-cat.gif▾
yeungkc
08/13/2021, 5:02 PMDominaezzz
08/13/2021, 5:24 PMyeungkc
08/13/2021, 5:31 PMyeungkc
08/13/2021, 5:35 PMThe second one [2], written by @olonho, is a bit more complex, but has better performance, with a CPU usage of around 25%.I would like to correct that after I run it for a while, the CPU usage reaches about 10%
yeungkc
08/14/2021, 6:46 AM