Signal-iOS
Signal-iOS copied to clipboard
Improve audio messages performance
Contributor checklist
- [x] My commits are rebased on the latest main branch
- [x] My commits are in nice logical chunks
- [x] My contribution is fully baked and is ready to be merged as is
- [x] I have tested my contribution on these devices:
- iPhone 12, iOS 17.4.1
- iPhone 7, iOS 15.8.2
Description
- 1st commit:
Whenever audio attachment is playing there are a lot of unnecessary work done in
AudioWaveformProgressView.redrawSamples
. On every audio progress update there are paths recreated forplayedShapeLayer
andunplayedShapeLayer
. In my solution I drawunplayedShapeLayer
andplayedShapeLayer
once and further apply layer mask toplayedShapeLayer
to show progress. - 2nd commit:
AudioPlayer
triggers update UI progress 20 times per second with Timer. I replaced timer withCADisplayLink
which allowed to reduce updates number per second and improve animation smoothness.
Changes in 2 commits reduced CPU usage from 13% to 5% on my iPhone 12 (17.4.1).