Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve audio messages performance #5792

Closed

Conversation

alex1704
Copy link

Contributor checklist

  • My commits are rebased on the latest main branch
  • My commits are in nice logical chunks
  • My contribution is fully baked and is ready to be merged as is
  • 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 for playedShapeLayer and unplayedShapeLayer. In my solution I draw unplayedShapeLayer and playedShapeLayer once and further apply layer mask to playedShapeLayer to show progress.
  • 2nd commit:
    AudioPlayer triggers update UI progress 20 times per second with Timer. I replaced timer with CADisplayLink 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).

Copy link

stale bot commented Jul 14, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jul 14, 2024
Copy link

stale bot commented Jul 21, 2024

This issue has been closed due to inactivity.

@stale stale bot closed this Jul 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

None yet

1 participant